+
+
diff --git a/ui/apps/chat/.storybook/mockups/index.ts b/ui/apps/chat/.storybook/mockups/index.ts
new file mode 100644
index 000000000000..c4783bde1224
--- /dev/null
+++ b/ui/apps/chat/.storybook/mockups/index.ts
@@ -0,0 +1,15 @@
+// OS mockups for the stories: a desktop's wallpaper, and on it the macOS Dock and menu bar or the Windows taskbar,
+// to picture the brand's icons where the apps put them
+export {
+ default as MacDock,
+ PLACEHOLDERS as MAC_DOCK_PLACEHOLDERS,
+ type DockApp
+} from './MacDock.svelte';
+export { default as MacMenuBar } from './MacMenuBar.svelte';
+export { default as MacStatusIcon } from './MacStatusIcon.svelte';
+export { default as MockDesktop } from './MockDesktop.svelte';
+export {
+ default as WindowsTaskbar,
+ PLACEHOLDERS as WINDOWS_TASKBAR_PLACEHOLDERS,
+ type TaskbarApp
+} from './WindowsTaskbar.svelte';
diff --git a/ui/apps/chat/.storybook/preview.ts b/ui/apps/chat/.storybook/preview.ts
index c26ceaec6309..671aa2f95003 100644
--- a/ui/apps/chat/.storybook/preview.ts
+++ b/ui/apps/chat/.storybook/preview.ts
@@ -1,8 +1,16 @@
import '../src/app.css';
+import { MEDIA_QUERIES } from '#lib/constants/pwa.constants.ts';
+import { SurfaceTheme } from '#lib/enums/ui.enums.ts';
+import { applySurfaceTheme } from '#lib/utils/css.ts';
+import './docs.css';
+import { applyColorScheme } from './color-scheme';
import ModeWatcherDecorator from './decorators/ModeWatcherDecorator.svelte';
import TooltipProviderDecorator from './decorators/TooltipProviderDecorator.svelte';
import type { Preview } from '@storybook/sveltekit';
+applyColorScheme();
+window.matchMedia(MEDIA_QUERIES.PREFERS_DARK).addEventListener('change', applyColorScheme);
+
const preview: Preview = {
parameters: {
controls: {
@@ -16,6 +24,57 @@ const preview: Preview = {
disabled: true
},
+ options: {
+ // sidebar sections: the introduction and the guidelines for agents, then the two layers as the code has them.
+ // Llama UI is the library (ui/lib/ui): its foundations, base components, app components, Model UI and mockups.
+ // Llama Chat is the app (ui/apps/chat): its own foundations, then one folder per src/lib/components/app/,
+ // the full chat screen leading Chat. The brand and communications are in llama-brand's Storybook
+ storySort: {
+ order: [
+ 'Introduction',
+ 'Agents',
+ ['Design guidelines'],
+ 'Llama UI',
+ [
+ 'Foundations',
+ ['Colors', 'Typography', 'Sizing', 'Shapes', 'Elevation', 'Surfaces'],
+ 'Components',
+ ['Actions', 'Forms', 'Display', 'Overlays', 'Navigation'],
+ 'App components',
+ 'Models',
+ 'Mockups'
+ ],
+ 'Llama Chat',
+ [
+ 'Foundations',
+ ['Safe areas', 'Brand'],
+ 'Chat',
+ [
+ 'ChatScreen',
+ ['ChatScreen', '*'],
+ 'ChatForm',
+ 'ChatMessages',
+ 'ChatAttachments',
+ 'ChatTabs'
+ ],
+ 'Content',
+ 'Models',
+ 'MCP',
+ 'Navigation',
+ 'Settings',
+ ['DialogSettingsChat', 'Navigation', 'Sections'],
+ 'Dialogs',
+ 'Forms',
+ 'Actions',
+ 'Badges',
+ 'Misc',
+ 'Servers',
+ 'PWA'
+ ]
+ ]
+ }
+ },
+
a11y: {
// 'todo' - show a11y violations in the test UI only
// 'error' - fail CI on a11y violations
@@ -23,11 +82,50 @@ const preview: Preview = {
test: 'todo'
}
},
+ // read by tests/stories/pace.ts; the test runner always plays at full speed
+ globalTypes: {
+ interactionPace: {
+ description: 'Speed of the interactions a story plays',
+ toolbar: {
+ dynamicTitle: true,
+ icon: 'timer',
+ items: [
+ { title: 'Human pace', value: 'human' },
+ { title: 'Instant', value: 'instant' }
+ ],
+ title: 'Interaction pace'
+ }
+ },
+ // the light surface theme: Paper (white panels on a grey page) or Matte (grey glass on white)
+ surface: {
+ description: 'Light surface theme',
+ toolbar: {
+ dynamicTitle: true,
+ icon: 'paintbrush',
+ items: [
+ { title: 'Paper', value: SurfaceTheme.PAPER },
+ { title: 'Matte', value: SurfaceTheme.MATTE }
+ ],
+ title: 'Surface'
+ }
+ }
+ },
+ initialGlobals: {
+ interactionPace: 'human',
+ surface: SurfaceTheme.PAPER
+ },
decorators: [
- (story) => ({
+ (story, context) => {
+ applySurfaceTheme(context.globals.surface);
+
+ return story();
+ },
+ // `parameters.colorScheme` fixes a story to light or dark, whatever the viewer chose (a scene in a store screenshot)
+ (story, context) => ({
Component: ModeWatcherDecorator,
props: {
- children: story
+ children: story,
+ forced: context.parameters.colorScheme
}
}),
(story) => ({
diff --git a/ui/apps/chat/AGENTS.md b/ui/apps/chat/AGENTS.md
index efb369e1a8bd..c4c0a0f3c191 100644
--- a/ui/apps/chat/AGENTS.md
+++ b/ui/apps/chat/AGENTS.md
@@ -1,6 +1,22 @@
# Instructions for ui/apps/chat
-These add to the repository's [AGENTS.md](../../../AGENTS.md) for work in `ui/apps/chat`: **Llama Chat**, the chat client that llama-server bundles. **Llama UI**, the library, is `ui/lib/ui` (`@ggml-org/llama-ui`): Chat imports its tokens, fonts and base components from there (`@ggml-org/llama-ui/ui/`) and keeps no copy of them. `DESIGN.md` lives here.
+These add to the repository's [AGENTS.md](../../../AGENTS.md) for work in `ui/apps/chat`: **Llama Chat**, the chat client that llama-server bundles. **Llama UI**, the library, is `ui/lib/ui` (`@ggml-org/llama-ui`): Chat imports its tokens, fonts and base components from there (`@ggml-org/llama-ui/ui/`) and keeps no copy of them. `DESIGN.md` and the Storybook live here; the brand book, `BRAND.md`, and the brand and communications pages are in [ggml-org/llama-brand](https://github.com/ggml-org/llama-brand), with their own Storybook.
- **Design:** [DESIGN.md](DESIGN.md) holds the tokens, roles and rules, written for agents. Follow it for anything visual; when it and the CSS disagree, the CSS wins and DESIGN.md is updated.
+- **Stories:** a story lives with the code it shows. Llama UI's (its foundations, base components, app components and Model UI) are in `ui/lib/ui/tests/stories`, titled `Llama UI/...`, and run as the library's tests; this app's Storybook shows them too. Llama Chat's are in `tests/stories/`, one folder per `src/lib/components/app/` (`chat/` has one per Chat folder), titled `Llama Chat//`. An accessibility story sits next to its component's, as `.a11y.stories.svelte`, titled `...//Accessibility`.
- **Components:** the `SKILL.md` next to a component folder (such as [src/lib/components/app/SKILL.md](src/lib/components/app/SKILL.md)) holds that folder's conventions.
+
+## Content is Markdown, custom pieces are Svelte: .svx
+
+Anything that is mostly content (a doc, an overview, a showcase or a Storybook page with prose) is written in Markdown, and whatever Markdown cannot express (a live example, a diagram, a real component) is a Svelte component placed in it. Together that is a `.svx` page, compiled by [mdsvex](https://mdsvex.pngwk.com).
+
+- Write the prose as plain Markdown, so it reads well as source, for people and for agents alike.
+- Put each custom piece in its own `.svelte` file and import it in the page's `
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {#each RADII as [radius, label] (radius)}
-
- {label}
-
-
-
- {/each}
-
-
diff --git a/ui/apps/chat/tests/stories/ChatMessage.stories.svelte b/ui/apps/chat/tests/stories/ChatMessage.stories.svelte
deleted file mode 100644
index ff9518a70fc8..000000000000
--- a/ui/apps/chat/tests/stories/ChatMessage.stories.svelte
+++ /dev/null
@@ -1,416 +0,0 @@
-
-
- {
- const { settingsStore } = await import('#lib/stores/settings/index.svelte.ts');
-
- settingsStore.updateConfig('showRawOutputSwitch', false);
- }}
-/>
-
- {
- const { settingsStore } = await import('#lib/stores/settings/index.svelte.ts');
-
- settingsStore.updateConfig('showRawOutputSwitch', false);
- }}
-/>
-
- {
- const { settingsStore } = await import('#lib/stores/settings/index.svelte.ts');
-
- settingsStore.updateConfig('showRawOutputSwitch', false);
- }}
-/>
-
- {
- const { settingsStore } = await import('#lib/stores/settings/index.svelte.ts');
-
- settingsStore.updateConfig('showRawOutputSwitch', false);
- }}
-/>
-
- {
- const { settingsStore } = await import('#lib/stores/settings/index.svelte.ts');
-
- settingsStore.updateConfig('showRawOutputSwitch', true);
- }}
-/>
-
- {
- const { settingsStore } = await import('#lib/stores/settings/index.svelte.ts');
- const { conversationsStore } = await import('#lib/stores/conversations/index.svelte.ts');
-
- settingsStore.updateConfig('showMessageStats', true);
- settingsStore.updateConfig('showRawOutputSwitch', false);
- // The toggle reads the before size from the branch, so the story needs
- // the summarized turn in the active message list.
- conversationsStore.activeMessages = [preCompactionAssistant, compactionMessage];
- }}
-/>
-
- {
- const { settingsStore } = await import('#lib/stores/settings/index.svelte.ts');
- const { chatActivityStore } = await import('#lib/stores/chat/activity.svelte.ts');
- const { chatStore } = await import('#lib/stores/chat/index.svelte.ts');
-
- settingsStore.updateConfig('showRawOutputSwitch', false);
-
- // The summary request reports its prompt progress through the shared
- // processing state; seed one so the story shows the prefill detail.
- chatActivityStore.markCompacting('conv-1', compactionPendingMessage.id);
- chatStore.processing.setActiveConversation('conv-1');
- chatStore.processing.setState('conv-1', {
- contextTotal: 32768,
- contextUsed: 10000,
- hasNextToken: false,
- outputTokensMax: -1,
- outputTokensUsed: 0,
- progressPercent: 42,
- promptProgress: { cache: 0, processed: 4200, time_ms: 6000, total: 10000 },
- promptTokens: 0,
- speculative: false,
- status: 'preparing',
- temperature: 0.8,
- tokensDecoded: 0,
- tokensPerSecond: 0,
- tokensRemaining: -1,
- topP: 0.95
- });
- }}
-/>
-
- {
- const { settingsStore } = await import('#lib/stores/settings/index.svelte.ts');
- const { chatActivityStore } = await import('#lib/stores/chat/activity.svelte.ts');
- const { chatStore } = await import('#lib/stores/chat/index.svelte.ts');
-
- settingsStore.updateConfig('showRawOutputSwitch', false);
-
- // Prompt processing is over, so only the generated tokens are reported.
- chatActivityStore.markCompacting('conv-1', compactionGeneratingMessage.id);
- chatStore.processing.setActiveConversation('conv-1');
- chatStore.processing.setState('conv-1', {
- contextTotal: 32768,
- contextUsed: 45200,
- hasNextToken: true,
- outputTokensMax: -1,
- outputTokensUsed: 128,
- promptTokens: 42200,
- speculative: false,
- status: 'generating',
- temperature: 0.8,
- tokensDecoded: 128,
- tokensPerSecond: 25,
- tokensRemaining: -1,
- topP: 0.95
- });
- }}
-/>
-
- {
- const { settingsStore } = await import('#lib/stores/settings/index.svelte.ts');
-
- settingsStore.updateConfig('showRawOutputSwitch', false);
- // Phase 1: Stream reasoning content in chunks
- let reasoningText =
- 'I need to think about this carefully. Let me break down the problem:\n\n1. The user is asking for help with something complex\n2. I should provide a thorough and helpful response\n3. I need to consider multiple approaches\n4. The best solution would be to explain step by step\n\nThis approach will ensure clarity and understanding.';
- let reasoningChunk = 'I';
- let i = 0;
-
- while (i < reasoningText.length) {
- const chunkSize = Math.floor(Math.random() * 5) + 3; // Random 3-7 characters
- const chunk = reasoningText.slice(i, i + chunkSize);
-
- reasoningChunk += chunk;
-
- // Update the reactive state directly
- streamingMessage.thinking = reasoningChunk;
-
- i += chunkSize;
- await new Promise((resolve) => setTimeout(resolve, 50));
- }
-
- const regularText =
- "Based on my analysis, here's the solution:\n\n**Step 1:** First, we need to understand the requirements clearly.\n\n**Step 2:** Then we can implement the solution systematically.\n\n**Step 3:** Finally, we test and validate the results.\n\nThis approach ensures we cover all aspects of the problem effectively.";
-
- let contentChunk = '';
-
- i = 0;
-
- while (i < regularText.length) {
- const chunkSize = Math.floor(Math.random() * 5) + 3; // Random 3-7 characters
- const chunk = regularText.slice(i, i + chunkSize);
-
- contentChunk += chunk;
-
- // Update the reactive state directly
- streamingMessage.content = contentChunk;
-
- i += chunkSize;
- await new Promise((resolve) => setTimeout(resolve, 50));
- }
-
- streamingMessage.timestamp = Date.now();
- }}
->
-
-
-
-
-
- {
- const { settingsStore } = await import('#lib/stores/settings/index.svelte.ts');
-
- settingsStore.updateConfig('showRawOutputSwitch', false);
- // Import the chat store to simulate loading state
- const { chatStore } = await import('#lib/stores/chat/index.svelte.ts');
-
- // Set loading state to true to trigger the processing UI
- chatStore.isLoading = true;
-
- // Simulate the processing state hook behavior
- // This will show the "Generating..." text and parameter details
- await new Promise((resolve) => setTimeout(resolve, 100));
- }}
-/>
diff --git a/ui/apps/chat/tests/stories/ChatScreenForm.stories.svelte b/ui/apps/chat/tests/stories/ChatScreenForm.stories.svelte
deleted file mode 100644
index 1240b595bdad..000000000000
--- a/ui/apps/chat/tests/stories/ChatScreenForm.stories.svelte
+++ /dev/null
@@ -1,95 +0,0 @@
-
-
- {
- const editor = await canvas.findByRole('textbox');
- const submitButton = await canvas.findByRole('button', { name: 'Send' });
-
- // Expect the input to be focused after the component is mounted
- await expect(editor).toHaveFocus();
-
- // Expect the submit button to be disabled
- await expect(submitButton).toBeDisabled();
-
- const text = 'What is the meaning of life?';
-
- await userEvent.clear(editor);
- await userEvent.type(editor, text);
-
- await expect(editor).toHaveTextContent(text);
-
- const fileInput = document.querySelector('input[type="file"]');
-
- await expect(fileInput).not.toHaveAttribute('accept');
- }}
-/>
-
-
-
- {
- const jpgAttachment = canvas.getByAltText('1.jpg');
- const svgAttachment = canvas.getByAltText('hf-logo.svg');
- const pdfFileExtension = canvas.getByText('PDF');
- const pdfAttachment = canvas.getByText('example.pdf');
- const pdfSize = canvas.getByText('342.82 KB');
-
- await expect(jpgAttachment).toBeInTheDocument();
- await expect(jpgAttachment).toHaveAttribute('src', jpgAsset);
-
- await expect(svgAttachment).toBeInTheDocument();
- await expect(svgAttachment).toHaveAttribute('src', svgAsset);
-
- await expect(pdfFileExtension).toBeInTheDocument();
- await expect(pdfAttachment).toBeInTheDocument();
- await expect(pdfSize).toBeInTheDocument();
- }}
-/>
diff --git a/ui/apps/chat/tests/stories/DesignGuidelines.mdx b/ui/apps/chat/tests/stories/DesignGuidelines.mdx
new file mode 100644
index 000000000000..d4b35cec5ab9
--- /dev/null
+++ b/ui/apps/chat/tests/stories/DesignGuidelines.mdx
@@ -0,0 +1,30 @@
+import { Markdown, Meta, Source, Unstyled } from '@storybook/addon-docs/blocks';
+import designMd from '../../DESIGN.md?raw';
+
+export const [, tokens, guidelines] = designMd.split(/^---$/m);
+
+
+
+
+
+
+# Design guidelines
+
+
+
+**Written for agents first.** This is the how of Llama UI, in a form an agent can follow when it builds or changes the UI: the tokens, the roles and the rules, precise rather than persuasive. People can read it too.
+
+
+
+Rendered from `ui/apps/chat/DESIGN.md`. The implementation lives in `ui/lib/ui/src/lib/styles`, and every token and surface below can be seen under **Llama UI** in this Storybook. The logo, type and colours are in llama-brand's Storybook.
+
+{guidelines}
+
+## Tokens
+
+The machine-readable half of `ui/apps/chat/DESIGN.md`, in the [DESIGN.md format](https://github.com/google-labs-code/design.md). Check it with `npx @google/design.md lint DESIGN.md`.
+
+
+
+
+
diff --git a/ui/apps/chat/tests/stories/Introduction.mdx b/ui/apps/chat/tests/stories/Introduction.mdx
deleted file mode 100644
index 7ee9182689c4..000000000000
--- a/ui/apps/chat/tests/stories/Introduction.mdx
+++ /dev/null
@@ -1,44 +0,0 @@
-import { Meta } from '@storybook/addon-docs/blocks';
-
-
-
-# Llama Chat
-
-Welcome to **Llama UI**, the component library of Llama Chat! This Storybook showcases the components used in Llama Chat, the modern web interface for the llama-server.
-
-## 🚀 About This Project
-
-Llama Chat is a modern web interface for the llama-server, built with SvelteKit and ShadCN UI. Features include:
-
-- **Real-time chat conversations** with AI assistants
-- **Multi-conversation management** with persistent storage
-- **Advanced parameter tuning** for model behavior
-- **File upload support** for multimodal interactions
-- **Responsive design** that works on desktop and mobile
-
-## 🎨 Design System
-
-The UI is built using:
-
-- **SvelteKit** - Modern web framework with excellent performance
-- **Tailwind CSS** - Utility-first CSS framework for rapid styling
-- **ShadCN/UI** - High-quality, accessible component library
-- **Lucide Icons** - Beautiful, consistent icon set
-
-## 🔧 Development
-
-This Storybook serves as both documentation and a development environment for the UI components. Each story demonstrates:
-
-- **Component variations** - Different states and configurations
-- **Interactive examples** - Live components you can interact with
-- **Usage patterns** - How components work together
-- **Styling consistency** - Unified design language
-
-## 🚀 Getting Started
-
-To explore the components:
-
-1. **Browse the sidebar** to see all available components
-2. **Click on stories** to see different component states
-3. **Use the controls panel** to interact with component props
-4. **Check the docs tab** for detailed component information
diff --git a/ui/apps/chat/tests/stories/MarkdownContent.stories.svelte b/ui/apps/chat/tests/stories/MarkdownContent.stories.svelte
deleted file mode 100644
index a3d3662f6e1e..000000000000
--- a/ui/apps/chat/tests/stories/MarkdownContent.stories.svelte
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {
- const { canvasElement } = context;
-
- // Wait for component to render
- await new Promise((resolve) => setTimeout(resolve, 100));
-
- // Find all links in the rendered content
- const links = (canvasElement as HTMLElement).querySelectorAll(
- 'a[href]'
- ) as NodeListOf;
- const linkList = Array.from(links) as HTMLAnchorElement[];
-
- // Test that we have the expected number of links
- expect(links.length).toBeGreaterThan(0);
-
- // Test each link for proper attributes
- links.forEach((link: HTMLAnchorElement) => {
- const href = link.getAttribute('href');
-
- // Test that external links have proper security attributes
- if (href && (href.startsWith('http://') || href.startsWith('https://'))) {
- expect(link.getAttribute('target')).toBe('_blank');
- expect(link.getAttribute('rel')).toBe('noopener noreferrer');
- }
- });
-
- // Test specific links exist
- const hugginFaceLink = linkList.find(
- (link) => link.getAttribute('href') === 'https://huggingface.co'
- );
-
- expect(hugginFaceLink).toBeTruthy();
- expect(hugginFaceLink?.textContent).toBe('Hugging Face Homepage');
-
- const githubLink = linkList.find(
- (link) => link.getAttribute('href') === 'https://github.com/ggml-org/llama.cpp'
- );
-
- expect(githubLink).toBeTruthy();
- expect(githubLink?.textContent).toBe('GitHub Repository');
-
- const openaiLink = linkList.find((link) => link.getAttribute('href') === 'https://openai.com');
-
- expect(openaiLink).toBeTruthy();
- expect(openaiLink?.textContent).toBe('OpenAI Website');
-
- const googleLink = linkList.find(
- (link) => link.getAttribute('href') === 'https://www.google.com'
- );
-
- expect(googleLink).toBeTruthy();
- expect(googleLink?.textContent).toBe('Google Search');
-
- // Test inline links (auto-linked URLs)
- const exampleLink = linkList.find(
- (link) => link.getAttribute('href') === 'https://example.com'
- );
-
- expect(exampleLink).toBeTruthy();
-
- const pythonDocsLink = linkList.find(
- (link) => link.getAttribute('href') === 'https://docs.python.org'
- );
-
- expect(pythonDocsLink).toBeTruthy();
-
- console.log(`✅ URL Links test passed - Found ${links.length} links with proper attributes`);
- }}
-/>
diff --git a/ui/apps/chat/tests/stories/ModelsSelector.stories.svelte b/ui/apps/chat/tests/stories/ModelsSelector.stories.svelte
deleted file mode 100644
index 2894596fc005..000000000000
--- a/ui/apps/chat/tests/stories/ModelsSelector.stories.svelte
+++ /dev/null
@@ -1,268 +0,0 @@
-
-
-
-
-
-
+
+ {/each}
+
+
+
+ {#each tiles as tile, i (tile.name)}
+ step}
+ n={String(i + 1).padStart(2, '0')}
+ onclick={() => (from = { at: i })}
+ title={titles[tile.name]}
+ view="0 0 {placement.size} {placement.size}"
+ >
+ {#snippet drawing()}
+
+
+
+
+
+
+
+ {#each PATHS as d (d)}{/each}
+
+
+ {#if tile.name === 'measured'}
+ {#each gaps(tile.x, tile.y) as g (g.kind + g.name)}
+
+ {/each}
+ {:else}
+
+ {/if}
+ {/snippet}
+
+ {#if tile.name === 'centred'}
+ At the exact centre of the square, the icon reads low: its weight sits in the wide foot.
+ {:else if tile.name === 'lifted'}
+ Up 1/{lift} of its height, it looks centred.
+ {:else if tile.name === 'nudged'}
+ Left 1/{nudge} of its width: where the files place it, in the avatars and the PWA icon.
+ {:else}
+ Each gap between the crop and the icon's outer points, filled by a circle touching both.
+ {/if}
+
+ {/each}
+
+
+
+ The icon fills {Math.round((side / placement.size) * 100)}% of the side; the numbers are pixels
+ at {placement.size}
+ × {placement.size}. Each circle fills the gap between the circle crop and one of the icon’s
+ outer points: orange at the rounded corners (the blade’s top left, the foot’s bottom right),
+ grey at the sharp corners (the blade’s top right, the foot’s bottom left), blue at the tips in
+ the middle (the blade’s left, the foot’s right). No placement evens all three pairs, since the
+ tips are even only without a sideways nudge; lifted 1/{lift} and nudged 1/{nudge} left, the files
+ keep every pair within a few pixels.
+
+
+
+
diff --git a/ui/apps/chat/tests/stories/brand/assets/files/native/macos/icon_512x512@2x.png b/ui/apps/chat/tests/stories/brand/assets/files/native/macos/icon_512x512@2x.png
new file mode 100644
index 000000000000..159c775028fa
Binary files /dev/null and b/ui/apps/chat/tests/stories/brand/assets/files/native/macos/icon_512x512@2x.png differ
diff --git a/ui/apps/chat/tests/stories/brand/assets/files/native/windows/Square150x150Logo.scale-400.png b/ui/apps/chat/tests/stories/brand/assets/files/native/windows/Square150x150Logo.scale-400.png
new file mode 100644
index 000000000000..748ca35a5e0e
Binary files /dev/null and b/ui/apps/chat/tests/stories/brand/assets/files/native/windows/Square150x150Logo.scale-400.png differ
diff --git a/ui/apps/chat/tests/stories/brand/assets/files/native/windows/Square44x44Logo.scale-400.png b/ui/apps/chat/tests/stories/brand/assets/files/native/windows/Square44x44Logo.scale-400.png
new file mode 100644
index 000000000000..970ef0295c72
Binary files /dev/null and b/ui/apps/chat/tests/stories/brand/assets/files/native/windows/Square44x44Logo.scale-400.png differ
diff --git a/ui/apps/chat/tests/stories/brand/fonts/LlamaMono.woff2 b/ui/apps/chat/tests/stories/brand/fonts/LlamaMono.woff2
new file mode 100644
index 000000000000..c8cd45657bfe
Binary files /dev/null and b/ui/apps/chat/tests/stories/brand/fonts/LlamaMono.woff2 differ
diff --git a/ui/apps/chat/tests/stories/brand/fonts/fonts.css b/ui/apps/chat/tests/stories/brand/fonts/fonts.css
new file mode 100644
index 000000000000..8d9409b2fd94
--- /dev/null
+++ b/ui/apps/chat/tests/stories/brand/fonts/fonts.css
@@ -0,0 +1,8 @@
+/* Llama Mono for the brand showcases (logo and type); Llama Sans is the design system's own (src/app.css) */
+@font-face {
+ font-family: 'Llama Mono';
+ src: url('./LlamaMono.woff2') format('woff2');
+ font-weight: 400 700;
+ font-style: normal;
+ font-display: block;
+}
diff --git a/ui/apps/chat/tests/stories/brand/logo-showcase/ShowcaseFrame.svelte b/ui/apps/chat/tests/stories/brand/logo-showcase/ShowcaseFrame.svelte
new file mode 100644
index 000000000000..05899dc7fcce
--- /dev/null
+++ b/ui/apps/chat/tests/stories/brand/logo-showcase/ShowcaseFrame.svelte
@@ -0,0 +1,58 @@
+
+
+
+
+
+
diff --git a/ui/apps/chat/tests/stories/brand/logo-showcase/lib/logo.ts b/ui/apps/chat/tests/stories/brand/logo-showcase/lib/logo.ts
new file mode 100644
index 000000000000..f8a067f4569f
--- /dev/null
+++ b/ui/apps/chat/tests/stories/brand/logo-showcase/lib/logo.ts
@@ -0,0 +1,72 @@
+// Geometry of the Llama icon (ggml-org/llama-brand, icon/icon-light.svg, a 600 x 600 drawing).
+// Everything the logo page draws is derived from these numbers.
+
+export type Pt = [number, number];
+
+export const SIZE = 600;
+export const SPLIT = 392; // where the two blades meet
+export const PATHS = [
+ 'M600 392L504.249 558L504.137 557.929C487.252 584.069 458.193 600 426.864 600H120L240 392H600Z',
+ 'M240 392H0L199.602 46.0254C216.032 17.5463 246.411 3.25756e-05 279.29 0H466.154L240 392Z'
+];
+
+// the four slanted edges, as two points each
+export const edges: Record = {
+ lowerRight: [
+ [600, 392],
+ [504.249, 558]
+ ],
+ shared: [
+ [466.154, 0],
+ [120, 600]
+ ], // upper blade's right edge and lower blade's left edge: one line
+ upperLeft: [
+ [0, 392],
+ [199.602, 46.0254]
+ ]
+};
+
+export const angle = (a: Pt, b: Pt) =>
+ (Math.atan2(Math.abs(b[1] - a[1]), Math.abs(b[0] - a[0])) * 180) / Math.PI;
+
+// the rounded corners: tangent points, the sharp corner they replace, and the circle they follow
+function corner(tangentEdge: Pt, tangentFlat: Pt, sharp: Pt, inward: 1 | -1) {
+ const trim = Math.hypot(tangentFlat[0] - sharp[0], tangentFlat[1] - sharp[1]);
+ const r = trim * Math.tan(Math.PI / 3); // the corner is 120°, so r = trim · tan 60°
+
+ return {
+ centre: [tangentFlat[0], tangentFlat[1] + inward * r] as Pt,
+ r,
+ sharp,
+ tangentEdge,
+ tangentFlat,
+ trim
+ };
+}
+const xAt = (e: [Pt, Pt], y: number) =>
+ e[0][0] + ((y - e[0][1]) * (e[1][0] - e[0][0])) / (e[1][1] - e[0][1]);
+
+export const corners = [
+ corner([199.602, 46.0254], [279.29, 0], [xAt(edges.upperLeft, 0), 0], 1),
+ corner([504.249, 558], [426.864, 600], [xAt(edges.lowerRight, 600), 600], -1)
+];
+
+/** Extend the line through a and b to the edges of a box (x0, y0, x1, y1). */
+export function extend(a: Pt, b: Pt, box: [number, number, number, number]): [Pt, Pt] {
+ const [x0, y0, x1, y1] = box;
+ const dx = b[0] - a[0],
+ dy = b[1] - a[1];
+ const ts: number[] = [];
+
+ if (dx) ts.push((x0 - a[0]) / dx, (x1 - a[0]) / dx);
+
+ if (dy) ts.push((y0 - a[1]) / dy, (y1 - a[1]) / dy);
+
+ const inside = ts
+ .map((t) => [a[0] + dx * t, a[1] + dy * t] as Pt)
+ .filter(([x, y]) => x >= x0 - 1e-6 && x <= x1 + 1e-6 && y >= y0 - 1e-6 && y <= y1 + 1e-6);
+
+ inside.sort((p, q) => p[0] - q[0] || p[1] - q[1]);
+
+ return [inside[0], inside.at(-1)!];
+}
diff --git a/ui/apps/chat/tests/stories/brand/logo-showcase/lib/styles/logo.css b/ui/apps/chat/tests/stories/brand/logo-showcase/lib/styles/logo.css
new file mode 100644
index 000000000000..59afe43b4902
--- /dev/null
+++ b/ui/apps/chat/tests/stories/brand/logo-showcase/lib/styles/logo.css
@@ -0,0 +1,50 @@
+/* The logo showcase's colours, shared by every drawing (the blueprint, the origin animation, the step tiles and the
+ rule panels). Grayscale after the brand: black icon on light grey in light mode, white icon on near-black in dark
+ mode; construction lines in a mid grey that reads over both the icon and the ground. Greys follow the llama.cpp
+ design system's neutrals. Dark mode follows the design system's .dark class on . */
+:root {
+ --l-bg: oklch(0.97 0 0); /* neutral-100 */
+ --l-shape: #111111;
+ --l-shape-2: #6b6b6b;
+ --l-faint: rgba(17, 17, 17, 0.16);
+ --l-line: oklch(0.708 0 0); /* neutral-400 */
+ --l-ink: #111111;
+ --l-muted: oklch(0.556 0 0); /* fg-muted */
+ --l-panel: oklch(1 0 0); /* surface-raised */
+ --l-rule: oklch(0.922 0 0); /* line-field */
+ --l-mark: #ee6c1e; /* cinder, the one accent: marks a detail, such as the L's empty centre */
+ --l-bolt: #ee6c1e; /* cinder, as in the .cpp of the llama.cpp lockup: the L flashes in it */
+ /* the lightning: a white-hot core, a yellow glow around it and a blue halo beyond; the L flashes in --l-bolt */
+ --l-bolt-core: #ffffff;
+ --l-bolt-glow: #ffd23f;
+ --l-bolt-halo: #3d8bff;
+ --l-ink-glow: 0.3; /* the L's glow in light mode, where it is black */
+ /* the strike's night sky, light mode only */
+ --l-night: 1;
+ --l-night-sky: oklch(0.16 0 0);
+ --l-night-ink: #fafafa;
+ /* in light mode the bolt is solid, so it reads crisply inside the black L (see-through yellow over black turns olive) */
+ --l-bolt-alpha: 1;
+ --l-bolt-tint: 0;
+ --l-paper: oklch(0.985 0 0); /* neutral-50 */
+ --l-grid: rgba(17, 17, 17, 0.05);
+ --l-grid-major: rgba(17, 17, 17, 0.13);
+}
+:root.dark {
+ --l-bg: oklch(0.16 0 0);
+ --l-shape: #fafafa;
+ --l-shape-2: #9e9e9e;
+ --l-faint: rgba(250, 250, 250, 0.18);
+ --l-line: oklch(0.439 0 0);
+ --l-ink: #fafafa;
+ --l-muted: oklch(0.708 0 0);
+ --l-panel: oklch(0.205 0 0);
+ --l-rule: oklch(1 0 0 / 0.12);
+ --l-bolt-alpha: 0.85;
+ --l-bolt-tint: 0.3;
+ --l-ink-glow: 1;
+ --l-night: 0;
+ --l-paper: oklch(0.205 0 0);
+ --l-grid: rgba(250, 250, 250, 0.05);
+ --l-grid-major: rgba(250, 250, 250, 0.13);
+}
diff --git a/ui/apps/chat/tests/stories/brand/logo-usage/IconUsage.svelte b/ui/apps/chat/tests/stories/brand/logo-usage/IconUsage.svelte
new file mode 100644
index 000000000000..e7658f03b296
--- /dev/null
+++ b/ui/apps/chat/tests/stories/brand/logo-usage/IconUsage.svelte
@@ -0,0 +1,966 @@
+
+
+
+
+{#if section === 'glyphs'}
+
In Llama Sans · U+E002, U+E001 and U+E000
+
+
Three glyphs of the font
+
+
+ The icon is a character of Llama Sans, in two sizes, so anything set in it can carry the mark
+ without an image, in the text's colour and weight. U+E001 is the one to reach for: the icon 1.24
+ times the cap height, centred on the capitals, with the lockup's gap after it. Use it in small
+ text, in controls and before a name, where a cap-height mark would read as smaller than the
+ letters. U+E000 sits on the baseline at exactly the cap height: keep it for headlines, where the
+ icon should sit quietly among large capitals and not stand out. In all caps, the case feature
+ swaps U+E000 for U+E001. U+E002 is the lockup: U+E001 with the space after it built in, typed
+ straight before the name, in Llama Sans or in Llama Mono, which carries it too.
+
+
+
+
llama.cpp
+
+
Llama
+
+
+
+
+ U+E002 · the lockupLlama
+
+
+
+ U+E001 · small text, controls, namesModels run locally in Llama.
+
+
+
+ U+E000 · headlinesRun it in Llama
+
+
+{/if}
+
+
+{#if section === 'buttons'}
+
In buttons
+
+
Open in Llama
+
+
+ Buttons always take the capital glyph, U+E001: at a label's size the cap-height glyph reads as
+ smaller than the letters beside it. As a glyph, the icon centres on the button's line box like
+ the label's capitals, with a word space after it, so it needs no icon slot and no nudging. These
+ are the design system's own buttons.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{/if}
+
+
+{#if section === 'context'}
+
The lockups in context
+
+
Where the name goes
+
+
+ The two lockups at the sizes they are used at: the README banner, app headers, a terminal, a
+ footer and a hero. Llama, the app, is set in Llama Sans with its capital L; llama.cpp, the
+ engine, in Llama Mono and all lowercase, as it is typed in a terminal. Both start with the
+ lockup glyph, U+E002: the capital icon with the gap built in, so the lockup is one character and
+ the name. Llama Mono's is drawn a little larger: with the icons matched, llama.cpp's wider,
+ heavier letters set at 90% of Llama's. The llama.cpp lockup always sits on a neutral ground
+ (white, the greys, ink); only the Llama lockup goes on colour, the day sky and the night sky.
+
+
+
+
+ {#each ['dark', 'light'] as const as tone (tone)}
+
+ Our own equivalent of a store badge, for links to download Llama or get llama.cpp: a dark key
+ with the icon at the height of its two lines and a small line over the name. 48 px high (40 for
+ a compact one), radius 10, the icon the capital glyph (U+E001) at 18 px, 14 from the left edge
+ and 10 from the text.
+
+ In small text the icon takes its capital form, U+E001, so it holds its own next to the letters;
+ in a headline, the cap-height U+E000 sits quietly among the capitals. Use it before the name it
+ stands for, never as a word on its own.
+
+
+
+
+ Models load with llama.cpp and run locally in Llama, on your own machine.
+
+
+
+ Models load with llama.cpp and run locally in Llama, on your own machine.
+
+
+
Run it in Llama.
+
+{/if}
+
+
+{#if section === 'icons'}
+
App icons and avatars
+
+
On the tab, the home screen and the profile
+
+
+
+ Every icon starts from the same placement. Centred exactly, the L reads low, its weight in the
+ wide foot; so the icon is lifted {Math.round(OPTICAL_LIFT * 1000) / 10}% of its height and
+ nudged
+ {Math.round(OPTICAL_NUDGE * 1000) / 10}% of its width left, and looks centred. Cut to a circle,
+ as in the social avatars and the PWA icon, it then clears the circle's edge at its corners and
+ tips nearly evenly. Drawn from the avatar file itself, the icon at 56% of a square, which every
+ platform crops round.
+
+
+
+
+
+
+
+ The web app's favicon, PWA, maskable and Apple touch icons, with their proportions drawn in. All
+ of them start from the favicon, the icon with a {percent(
+ PWA_ASSET_GENERATOR.FAVICON_PADDING / 2
+ )} margin; the square icons add the generator's 30% padding, and the PWA icon is the maskable one
+ at 85%, cut round. The files Llama Chat ships still carry the old llama.cpp mark; these are drawn
+ with the L.
+
+
+
+ {#each icons as icon (icon.label)}
+ {@const p = placed(100, 100, icon.scale)}
+
+
+
+
+ {icon.label}
+
+ {#each icon.spec as line (line)}{line}{/each}
+
+ {icon.files}
+
+
+ {/each}
+
+
+
+
Native app icons
+
+
+ {#each nativeIcons as icon (icon.label)}
+
+
+
+
+ {icon.label}
+
+ {#each icon.spec as line (line)}{line}{/each}
+
+ {icon.files}
+
+
+ {/each}
+
+
+
+
+ {#each ['light', 'dark'] as const as mode (mode)}
+
+
+
+
+
+
+
+ macOS, the menu bar and the Dock, {mode}
+
+
+
+
+
+
+
+ Windows, the taskbar and the tray, {mode}
+
+ {/each}
+
+{/if}
+
+
+{#if section === 'splash'}
+
Splash screens
+
+
While the app opens
+
+
+ For now the splash screens are the icon alone, centred on the light or dark page colour at
+ {percent(splash)} of the screen's shorter side, for every iPhone and iPad size, upright and on its
+ side. A designed splash screen will follow.
+
+
+
+
+ {
+ await waitFor(() => expect(canvas.getByText('Failed to load PDF images')).toBeInTheDocument(), {
+ timeout: 5000
+ });
+
+ // a retry loop would flip back to the loading state
+ await new Promise((resolve) => setTimeout(resolve, 500));
+ await expect(canvas.queryByText('Converting PDF to images...')).not.toBeInTheDocument();
+ await expect(canvas.getByText('Failed to load PDF images')).toBeInTheDocument();
+ }}
+>
+
This is where Llama UI and Llama Chat are designed, built and checked. Everything in it is the real component, font or file, so what you see here is what ships. The Llama Brand and the communications made with it have their own Storybook, in llama-brand.
+
+## In short
+
+The component library **Llama UI**, built on the **Llama Brand** (the icon, Llama Sans and Llama Mono, the colours), and the app **Llama Chat** built from it, in one place, for the people and agents who design and build Llama products.
+
+
+
+
+
+## What it's for
+
+
+
+
+
+## How we think
+
+
+
+
+
+## How it fits together
+
+
+
+
+
+Inside Llama UI, the tokens go from primitives to semantic roles to components, in `ui/lib/ui/src/lib/styles/tokens/`, and `DESIGN.md` is generated from them. Llama UI draws the interface and handles interaction; each app owns its own state.
+
+## How it's laid out
+
+
+
+
+
+## Working in it
+
+- Run it with `npm run storybook` in `ui/apps/chat`.
+- Pages that are mostly prose, like this one, are `.svx`: Markdown with Svelte components in it. `AGENTS.md` says how to write them.
+- Where a guideline and a story disagree, the story is right: it's the real thing.
diff --git a/ui/apps/chat/tests/stories/introduction/Principles.svelte b/ui/apps/chat/tests/stories/introduction/Principles.svelte
new file mode 100644
index 000000000000..326b03a6ed94
--- /dev/null
+++ b/ui/apps/chat/tests/stories/introduction/Principles.svelte
@@ -0,0 +1,228 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Offline
+
+ No account
+
+ Stays on the device
+
+
+
+
Personal, on hardware you already have
+
+
Private by default, and open to everyone.
+
+
+
+
+
+ Recommended
+
+ Reads, sees and hears
+
+
+
+
+
+
Simple by default
+
+
Choices made for you to start; every setting when you want it.
+
+
+
+
+
+
+ Aa
+
+
+
+
+
Recognisable, easy to change
+
+
The icon, the type, one accent. The rest is neutral.
+
+
+
+
+
+
+
+
Function first
+
+
Every element has a job and a reason for its size.
+
+
+
+
+
+
+
diff --git a/ui/lib/ui/tests/stories/app/SearchInput.stories.svelte b/ui/lib/ui/tests/stories/app/SearchInput.stories.svelte
new file mode 100644
index 000000000000..13db4d2be05c
--- /dev/null
+++ b/ui/lib/ui/tests/stories/app/SearchInput.stories.svelte
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ui/lib/ui/tests/stories/app/SyntaxHighlightedCode.stories.svelte b/ui/lib/ui/tests/stories/app/SyntaxHighlightedCode.stories.svelte
new file mode 100644
index 000000000000..e3bd6cc2abc2
--- /dev/null
+++ b/ui/lib/ui/tests/stories/app/SyntaxHighlightedCode.stories.svelte
@@ -0,0 +1,23 @@
+
+
+
diff --git a/ui/lib/ui/tests/stories/brand/fonts/LlamaMono.woff2 b/ui/lib/ui/tests/stories/brand/fonts/LlamaMono.woff2
new file mode 100644
index 000000000000..f43b2588dc35
Binary files /dev/null and b/ui/lib/ui/tests/stories/brand/fonts/LlamaMono.woff2 differ
diff --git a/ui/lib/ui/tests/stories/brand/fonts/OFL.txt b/ui/lib/ui/tests/stories/brand/fonts/OFL.txt
new file mode 100644
index 000000000000..04e95fc55085
--- /dev/null
+++ b/ui/lib/ui/tests/stories/brand/fonts/OFL.txt
@@ -0,0 +1,93 @@
+Copyright 2024 The Geist Project Authors (https://github.com/vercel/geist-font)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://openfontlicense.org
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
\ No newline at end of file
diff --git a/ui/lib/ui/tests/stories/brand/fonts/fonts.css b/ui/lib/ui/tests/stories/brand/fonts/fonts.css
new file mode 100644
index 000000000000..8d9409b2fd94
--- /dev/null
+++ b/ui/lib/ui/tests/stories/brand/fonts/fonts.css
@@ -0,0 +1,8 @@
+/* Llama Mono for the brand showcases (logo and type); Llama Sans is the design system's own (src/app.css) */
+@font-face {
+ font-family: 'Llama Mono';
+ src: url('./LlamaMono.woff2') format('woff2');
+ font-weight: 400 700;
+ font-style: normal;
+ font-display: block;
+}
diff --git a/ui/lib/ui/tests/stories/components/actions/Button.stories.svelte b/ui/lib/ui/tests/stories/components/actions/Button.stories.svelte
new file mode 100644
index 000000000000..bbabfd5a03e8
--- /dev/null
+++ b/ui/lib/ui/tests/stories/components/actions/Button.stories.svelte
@@ -0,0 +1,54 @@
+
+
+
+
+ {#each variants as variant (variant)}
+
+
@ggml-org/llama-ui is Llama UI as a package: the tokens, fonts, surfaces and components of Llama Chat, for llama.app first and the Llama apps after.
+
+## Where it comes from
+
+The package lives in llama.cpp, in `ui/lib/ui`, and Llama Chat, in `ui/apps/chat`, is built on it: its tokens, fonts and base components come from here. The stories of everything the package holds live here, next to it, and run as its tests. Llama Chat's Storybook shows the same stories under **Llama UI**, next to Llama Chat's own; the **Brand** and the **Communications** have their own Storybook, in llama-brand.
+
+The tokens, the fonts and the base components are changed here, and Llama Chat takes them as they are. What both still keep a copy of, the Model UI among them, flows one way for now, from `ui/apps/chat` to here.
+
+## What's in it
+
+- **Foundations:** the primitive, semantic and component tokens, the type, corner, icon and control-height roles, the matte surfaces and elevations, and Llama Sans and Llama Mono.
+- **Components:** the 29 base components Llama Chat is built from, Alert to Tooltip, grouped as actions, forms, display, overlays and navigation.
+- **App components:** the small parts an app on the library shares: ActionIcon, SearchInput and SyntaxHighlightedCode.
+- **Model UI:** how a model is shown in Llama Chat and on llama.app: its name and badges, capability icons, maker's avatar and quant chips, under **Models**. They take model data in and report what the user did out.
+
+## Using it
+
+Import the theme right after Tailwind, then the components:
+
+```css
+@import 'tailwindcss';
+@import 'tw-animate-css';
+@import '@ggml-org/llama-ui/theme.css';
+```
+
+```svelte
+
+
+
+Downloaded
+```
+
+Use the toolbar to switch between light and dark, and between the Paper and Matte light surfaces.
diff --git a/ui/lib/ui/tests/stories/mockups/AppMockups.stories.svelte b/ui/lib/ui/tests/stories/mockups/AppMockups.stories.svelte
new file mode 100644
index 000000000000..030051d5fdd0
--- /dev/null
+++ b/ui/lib/ui/tests/stories/mockups/AppMockups.stories.svelte
@@ -0,0 +1,59 @@
+
+
+{#snippet number(part: string)}
+ {part[0].toUpperCase()}
+{/snippet}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ui/lib/ui/tests/stories/models/ModelCapabilityIcons.stories.svelte b/ui/lib/ui/tests/stories/models/ModelCapabilityIcons.stories.svelte
new file mode 100644
index 000000000000..c7ddc5a73813
--- /dev/null
+++ b/ui/lib/ui/tests/stories/models/ModelCapabilityIcons.stories.svelte
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ui/lib/ui/tests/stories/models/ModelCard.stories.svelte b/ui/lib/ui/tests/stories/models/ModelCard.stories.svelte
new file mode 100644
index 000000000000..34285d875a55
--- /dev/null
+++ b/ui/lib/ui/tests/stories/models/ModelCard.stories.svelte
@@ -0,0 +1,54 @@
+
+
+{#snippet card(selected = false, dimmed = false)}
+ {}} {selected} tooltip="ggml-org/gpt-oss-20b-GGUF">
+ {#snippet avatar()}
+
+ {/snippet}
+
+ {#snippet title()}
+
+ {/snippet}
+
+
+
+
+ OpenAI's open-weight model for local reasoning and agents, with tool use and adjustable reasoning effort.
+