Starting Storybook
http://localhost:6006.
Building Static Storybook
To build a static version of Storybook that can be deployed:storybook-static/.
Writing Stories (full app only)
mux intentionally uses full-app stories (no isolated component stories). Stories live insrc/browser/stories/ and must be named App.*.stories.tsx.
Storybook is configured to load src/browser/stories/**/*.stories.@(ts|tsx) (see .storybook/main.ts).
Basic App story structure
Helpers & fixtures
src/browser/stories/meta.tsx– sharedappMeta+AppWithMockswrappersrc/browser/stories/mocks/orpc.ts–createMockORPCClient()for building anAPIClientsrc/browser/stories/mockFactory.ts– deterministic fixtures (workspaces, messages, timestamps)src/browser/stories/storyHelpers.ts/storyPlayHelpers.ts– localStorage + play-function helpers
Global styles & determinism
- Global CSS is loaded from
src/browser/styles/globals.cssin.storybook/preview.tsx. .storybook/preview.tsxstubsDate.now()to a stable value for deterministic snapshots; prefer usingNOW/STABLE_TIMESTAMPfrommockFactory.tswhen constructing fixtures.
Examples
See the existing stories for patterns:src/browser/stories/App.sidebar.stories.tsxsrc/browser/stories/App.chat.stories.tsxsrc/browser/stories/App.settings.stories.tsx
Configuration
.storybook/main.ts- Main Storybook configuration (stories glob, addons, Vite config).storybook/preview.tsx- Global decorators and snapshot stabilization helperstsconfig.json- Includes.storybook/**/*.ts(x)for type checking
Tips
- Keep story data deterministic (no
Math.random()/ realDate.now()in fixtures). - Use
playfunctions (@storybook/test) to navigate the UI into the desired state. - If async rendering changes element heights (Markdown, Mermaid, tool expansion), wait for scroll stabilization (double
requestAnimationFrame) before snapshotting.