* ui: Llama UI's own Storybook in ui/lib/ui The library gets its Storybook (`npm run storybook`, `npm run build-storybook`) with a story for everything it holds, under Llama UI: the foundations, the 29 base components (as actions, forms, display, overlays and navigation), the app components (ActionIcon, SearchInput, SyntaxHighlightedCode), the Model UI and the native app mockups. The stories import the package by its published names, aliased onto src/lib, run as tests under `npm test` (the storybook project in vite.config.ts), and are type-checked with the rest of the package. `npm run dev` starts Storybook next to the SvelteKit check page; the toolbar switches the color mode and the surface theme, and pages that are mostly prose are .svx, through mdsvex. Assisted-by: Claude (Opus 5.5 Medium) * ui: a Storybook for Llama Chat Llama Chat's Storybook gets an introduction, Agents › Design guidelines (DESIGN.md), Llama UI's stories as the library has them, and Llama Chat: its own foundations (safe areas, the splash screens), then one section per src/lib/components/app/<area> (Chat with the chat screen, form, messages, attachments and tabs; Content, Models, MCP, Navigation, Settings, Dialogs, Forms, Actions, Badges, Misc, Servers and PWA), each accessibility story next to its component's. It replaces the flat pages it had (chat message, chat form, markdown content, the PWA refresh alert and their fixtures, and the ChatForm single-row exploration). The stories run on the new tokens and surfaces with the color mode and surface theme in the toolbar (by mode-watcher's key, the ColorMode and SurfaceTheme enums and applySurfaceTheme), and pages that are mostly prose are .svx in an editorial frame (AGENTS.md says how to write them and where a story goes). The story tests run Llama Chat's stories and leave the library's to the library. The brand and communications pages are in ggml-org/llama-brand; the logo files come from @ggml-org/llama-brand. Assisted-by: Claude (Opus 5.5 Medium) * ui: let the ChatScreen story store its reply before the next one starts The ContinueConversation story ended while its reply was still being stored, and the next story reset the stores under it. It now waits for the reply to finish. Assisted-by: Claude (Fable 5.2) * ui: publish the Storybook to its Hugging Face Space on every UI change A new UI Storybook workflow builds ui/apps/chat's Storybook whenever ui/apps/chat or ui/lib/ui changes on master (or on demand) and uploads it to the static Space ggml-org/Llama-UI-storybook, with a Space card naming the commit it was built from. Files the new build no longer has are removed; the Space's .gitattributes stays. It runs only in ggml-org/llama.cpp, takes the UI's Hugging Face token (HF_TOKEN_UI_STATIC_OUTPUT), and the Space can be changed with the HF_SPACE_UI_STORYBOOK variable. Assisted-by: Claude (Opus 5.5 Medium) * ui: run the library's tests, its stories among them, in CI The Library checks job type-checked and packed ui/lib/ui but never ran its tests, so the library's stories, which now hold every library component's, went untested in CI. It installs Chromium and runs `npm test`. Assisted-by: Claude (Opus 5.5 Medium) * ui: draw a floating panel's rim on its border, so its edge is one line Menus, popovers, dialogs and the other matte-float panels carry a 1px border that the surface made transparent, and drew their inner highlight as an inset shadow. An inset shadow sits inside the border, so the 1px of fill between it and the outer ring showed as a second edge. The border now draws the highlight, right inside the ring. Assisted-by: Claude (Opus 5.5 Medium)
@ggml-org/llama-ui
Llama UI, the design system of Llama Chat and the Llama apps, as a package: its tokens, fonts, surfaces and
components, for Llama Chat (ui/apps/chat) and llama.pages (llama.app). It lives in llama.cpp at ui/lib/ui,
beside the apps built on it in ui/apps.
Use
/* app.css */
@import 'tailwindcss';
@import 'tw-animate-css';
@import '@ggml-org/llama-brand/css/colors.css';
@import '@ggml-org/llama-ui/theme.css';
<script lang="ts">
import { Badge, Button } from '@ggml-org/llama-ui';
</script>
<Button variant="secondary">View on Hugging Face</Button>
<Badge variant="success">Downloaded</Badge>
theme.css: everything: fonts, tokens, surfaces, the Tailwind theme and base styles. It needs Tailwind 4,tw-animate-css(both peer dependencies) and@ggml-org/llama-brand'scss/colors.cssimported before it.tokens.css: the three tiers of tokens only, also after@ggml-org/llama-brand'scss/colors.css.fonts.css: Llama Sans and Llama Mono.surfaces.css: the matte surface utilities.- Dark mode is the
darkclass on<html>; the Matte light surfaces are thetheme-matteclass.
What's in it
- Foundations: the primitive, semantic and component tokens, the type roles (
text-body,text-label…), corner, icon and control-height roles, the matte surfaces and elevations, Llama Sans and Llama Mono. - Components: every base component of Llama Chat: Alert, AlertDialog, Badge, Button, ButtonGroup, Card, Checkbox,
Collapsible, ContextMenu, Dialog, Drawer, DropdownMenu, Empty, HoverCard, Input, Label, Popover, RadioGroup,
ScrollArea, Select, Separator, Skeleton, Switch, Table, Tabs, Textarea, Toggle, ToggleGroup and Tooltip. Each is
also its own entry point (
@ggml-org/llama-ui/ui/dialog), withcnandtvat@ggml-org/llama-ui/utils. Then ActionIcon (an icon button with a tooltip), SearchInput (a search field with a clear button), SyntaxHighlightedCode (code as Llama Chat shows it, in highlight.js's GitHub themes; needsmode-watcher) and Logo (the brand mark, llama-brand's icon), at@ggml-org/llama-ui/app/actions,app/forms,app/contentandapp/misc.FILTER_TRIGGER_CLASSandFILTER_TOGGLE_ITEM_CLASSstyle a filters bar the way Llama Chat's Models Manager does. - App mockups: MacMenu (Llama for Mac's menu) and WindowsTray (Llama for Windows' tray flyout), the native apps' UIs as the brand's communications draw them, with an
annotatesnippet to pin a page's numbered callouts to their edges. - Model UI: how a model is shown in Llama Chat and on llama.app:
ModelCard,ModelFamilyCard(a family as llama.app's catalog shows it),ModelId(name, badges, capability, context and size icons),ModelCapabilityIcons(icons or labelled badges),ModelOrgAvatar,ModelMetadataItem,ModelQuantOptions,ModelQuantChip,ModelQuantRow,ModelDraftSidecars,ModelDownloadProgressBar, plus the formatters andminMemoryTierGbandsummarizeSizes, at@ggml-org/llama-ui/models. They take model data in and report what the user did out; fetching and downloading stay in the app.
Next: llama.app's model page.
The constants, enums and code helpers the components use are entry points too, for an app that shows the same things:
@ggml-org/llama-ui/constants (the shared classes and code-block constants), @ggml-org/llama-ui/enums (ColorMode,
TooltipSide, BooleanString) and @ggml-org/llama-ui/code (highlightCode, trimCodePadding). The model data
(constants, enums, formatters and types) comes with the Model UI at @ggml-org/llama-ui/models.
How the apps in this repo use it
Llama Chat does not install the package: it compiles these sources as part of its own build, so a change here shows in the app at once and the app keeps no copy of a component or a token. For that to work:
- Sources under
src/libimport each other by relative path, never through$lib, which in an app points at the app's ownsrc/lib. - What they import from npm is listed in
dependenciesorpeerDependencies: the app reads that list to resolve those packages from its ownnode_modules(ui/apps/chat/scripts/llama-ui.js). - Stylesheets import no package. An app imports Tailwind,
tw-animate-cssand@ggml-org/llama-brand'scss/colors.css(the brand's colours, under the names the primitives use) itself, beforetheme.css. - A component added with shadcn-svelte (
components.json) arrives with$libimports: make them relative.
Development
npm run storybook: the package's Storybook, with a story for everything it holds; the stories run as tests innpm test, and Llama Chat's Storybook (inui/apps/chat) shows them under Llama UInpm run dev: Storybook and a small SvelteKit check page (src/routes)npm run check: svelte-checknpm run prepack: build the library intodist/and run publintnode scripts/npm-version-check.mjs: what the release workflow would make of this folder, against the real registry
Releases
The package is published from here by
ui-lib-publish.yml, which runs when a commit reaches master with
ui/lib/ui in it. The version in package.json is the release: land a bump together with the change that should ship
and the workflow type-checks, builds, lints and publishes that version to npm, with a provenance attestation. A library
change that carries no bump publishes nothing and leaves a warning on the run.
npm version <patch|minor> --no-git-tag-versionand commit: it movespackage.jsonand both version fields of the lockfile together.- Below
1.0: a breaking change bumps the minor, a feature bumps the patch. - A version with a prerelease suffix (
0.5.0-beta.1) publishes under thenexttag, solateststays a stable build. - Publishing needs no token in the repo: the job trades its OIDC identity for one, so the only place to look when a
publish is refused is the package's trusted-publisher settings on npm. A publisher names a workflow that must already
exist under
.github/workflows, so it is added after this workflow lands, and it allows staged publishing untilnpm publishis permitted for it. Provenance is generated without asking, and only on a GitHub-hosted runner: a self-hosted one cannot publish this way.