Skip to content

ui: a Storybook for Llama UI and Llama Chat - #32485

Merged
allozaur merged 6 commits into
ggml-org:masterfrom
allozaur:allozaur/docs/llama-ui-storybook-upstream
Nov 18, 2026
Merged

allozaur merged 6 commits into
ggml-org:masterfrom
allozaur:allozaur/docs/llama-ui-storybook-upstream

Conversation

@allozaur

@allozaur allozaur commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Llama UI and Llama Chat get Storybooks with two jobs: documentation that people and coding agents read for context, and a test environment in which every story runs as a test. It follows #32468, which brought in Llama UI without its Storybook.

Additional information

flowchart LR
    subgraph code["In the repo, next to the code"]
        D["DESIGN.md"]
        L["Llama UI stories<br/>ui/lib/ui"]
        C["Llama Chat stories and pages<br/>ui/apps/chat"]
    end
    subgraph docs["Documentation, for people and agents"]
        SB["Llama Chat's Storybook<br/>Llama UI and Llama Chat sections"]
        HF["Hugging Face Space<br/>ggml-org/llama-ui-storybook"]
    end
    subgraph tests["Testing, in CI"]
        LT["Library checks<br/>npm test"]
        CT["E2E Tests<br/>story tests"]
    end
    D --> SB
    L --> SB
    C --> SB
    SB -->|"on master"| HF
    L --> LT
    C --> CT
Loading
  • Documentation: every Llama UI part and Llama Chat component in its states, with an introduction and the design guidelines agents follow (from DESIGN.md). It's published to a Hugging Face Space on every UI change on master.
  • Testing: each story is a test, run in Chromium: the library's in its npm test, now in CI, and Llama Chat's in its story tests.

Six commits, each reviewable alone: the library's Storybook, Llama Chat's, a story fix, the deploy workflow, the library's tests in CI and a fix to the floating panels' edge. The deploy needs HF_TOKEN_UI_STATIC_OUTPUT to have write access to the Space. The brand pages live in ggml-org/llama-brand, with their own Storybook.

What changed
  • Two sections, one per layer:
    • Llama UI (ui/lib/ui/tests/stories): Foundations, Components (the 29 base components as Actions, Forms, Display, Overlays and Navigation), App components (ActionIcon, SearchInput, SyntaxHighlightedCode), Models and Mockups.
    • Llama Chat (ui/apps/chat/tests/stories): its own Foundations (Safe areas, Brand), then one folder per src/lib/components/app/<area>: Chat (screen, form, messages, attachments, tabs), Content, Models, MCP, Navigation, Settings, Dialogs, Forms, Actions, Badges, Misc, Servers and PWA. Each accessibility story sits next to its component's.
  • Each story with its code:
    • The library's stories import it by its published names (@ggml-org/llama-ui/..., aliased onto src/lib), run as its tests (npm test, in Chromium) and are covered by its type check.
    • Llama Chat's Storybook includes them as they are, and its own story tests leave them to the library. Llama Chat's Tailwind also scans the library's stories, so the classes only they use (the Elevation samples, for one) are generated.
    • AGENTS.md says where a new story goes.
  • Pages: the introduction and Agents › Design guidelines (rendered from DESIGN.md). They replace the flat pages the Storybook had: chat message, chat form, markdown content, the PWA refresh alert and their fixtures, and the ChatForm single-row exploration.
  • Toolbar: the color mode and the Paper/Matte surface theme switch from Storybook's toolbar. They use mode-watcher's storage key, the ColorMode and SurfaceTheme enums and applySurfaceTheme from the app.
  • Prose pages: pages that are mostly text are .svx (Markdown with Svelte components in it, through mdsvex), set in an editorial frame.
  • Brand parts: the logo geometry, the fonts and the splash screens stay, because the pages draw with them. The logo files come from @ggml-org/llama-brand, which Llama Chat already depends on.
  • Deploy: a new UI Storybook workflow builds ui/apps/chat's Storybook whenever ui/apps/chat or ui/lib/ui changes on master, and on demand. It uploads the build to the static Space ggml-org/llama-ui-storybook and removes files the new build no longer has. It runs only in ggml-org/llama.cpp.
  • Floating panels' edge: menus, popovers, dialogs and the other matte-float panels drew their inner highlight as an inset shadow inside a transparent 1px border, so the fill between it and the outer ring showed as a second edge. The border now draws the highlight, right inside the ring, and the edge is one line.
  • One story fix: the ChatScreen story waits for its reply to be stored before the next story resets the stores.
Known gaps
  • npm run check in ui/apps/chat passes as CI runs it, with only Chat's dependencies installed. If ui/lib/ui/node_modules is also installed, it reports errors from a second copy of Svelte (5.57.2 in the library, 5.57.3 in Chat). That also happens on master.
  • Coverage still to come in follow-ups:
    • Foundations pages for motion, iconography and z-order. The tokens for motion and layering don't exist yet.
    • A toast, which is used but has no story or styling of its own.
    • Stories for most of Llama Chat's dialogs and shared menus, and for four Model UI components.
Testing
  • ui/lib/ui: the type check (stories included) and prepack pass, and so do its 63 tests, story tests included. Its Storybook builds.
  • ui/apps/chat, with only its own dependencies installed as in CI:
    • The type check and lint pass, and so do 771 unit, 271 client and 166 story tests.
    • npm run build-storybook builds with the library's stories in it (218 entries), and npm run storybook serves.
    • Links to the old story IDs redirect to the new ones (all 205 checked).

Requirements

@allozaur
allozaur force-pushed the allozaur/docs/llama-ui-storybook-upstream branch 2 times, most recently from d74bb3c to 69f6f24 Compare November 17, 2026 17:30
@github-actions github-actions Bot added documentation Improvements or additions to documentation devops improvements to build systems and github actions server/ui labels Nov 17, 2026
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)
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)
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)
@allozaur
allozaur force-pushed the allozaur/docs/llama-ui-storybook-upstream branch from 69f6f24 to cfcb6c2 Compare November 17, 2026 22:00
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)
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)
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)
@allozaur
allozaur force-pushed the allozaur/docs/llama-ui-storybook-upstream branch from cfcb6c2 to 2ee78eb Compare November 17, 2026 22:35
@allozaur
allozaur marked this pull request as ready for review November 17, 2026 23:17
@allozaur
allozaur requested review from a team as code owners November 17, 2026 23:17
@allozaur
allozaur merged commit 9e93cd8 into ggml-org:master Nov 18, 2026
11 checks passed
Annieren pushed a commit to Annieren/llama.cpp-upstream that referenced this pull request Nov 23, 2026
* 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)
Nindaleth pushed a commit to Nindaleth/llama.cpp that referenced this pull request Nov 26, 2026
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops improvements to build systems and github actions documentation Improvements or additions to documentation server/ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants