Skip to main content
Storybook renders Mux’s renderer UI without running the full Electron app.

Starting Storybook

This will start the Storybook development server at http://localhost:6006.

Building Static Storybook

To build a static version of Storybook that can be deployed:
The output will be in storybook-static/.

Writing Stories

Mux uses two Storybook patterns:
  • Full-app stories for integration/routing coverage (for example src/browser/stories/App.*.stories.tsx)
  • Colocated isolated stories for Settings section-level testing (for example src/browser/features/Settings/Sections/*.stories.tsx)
Storybook loads stories from src/browser/stories/**/*.stories.@(ts|tsx), src/browser/components/**/*.stories.@(ts|tsx), and src/browser/features/**/*.stories.@(ts|tsx) (see .storybook/main.ts).

Basic App story structure

Helpers & fixtures

  • src/browser/stories/meta.tsx – shared appMeta + AppWithMocks wrapper
  • src/browser/stories/mocks/orpc.tscreateMockORPCClient() for building an APIClient
  • src/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.css in .storybook/preview.tsx.
  • .storybook/preview.tsx stubs Date.now() to a stable value for deterministic snapshots; prefer using NOW / STABLE_TIMESTAMP from mockFactory.ts when constructing fixtures.

Examples

See the existing stories for patterns:
  • src/browser/stories/App.sidebar.stories.tsx
  • src/browser/stories/App.chat.stories.tsx
  • src/browser/features/Settings/Sections/<SectionName>.stories.tsx

Configuration

  • .storybook/main.ts - Main Storybook configuration (stories glob, addons, Vite config)
  • .storybook/preview.tsx - Global decorators and snapshot stabilization helpers
  • tsconfig.json - Includes .storybook/**/*.ts(x) for type checking

Tips

  • Keep story data deterministic (no Math.random() / real Date.now() in fixtures).
  • Use play functions (@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.