# Storybook Workflow

Storybook lives in `apps/storybook` and uses `@storybook/nextjs-vite`.

The workbench includes Docs, Controls, metadata-rendered design token references, `@storybook/addon-a11y`, local-only `@storybook/addon-mcp`, and MSW infrastructure. The current static slice has no network-like data, so handlers are intentionally empty.

## Docs And Controls

Use Storybook Docs as the acceptance surface for reusable UI. Component pages should include:

- A component description tied to the design-system boundary.
- Representative stories for real states.
- Explicit `argTypes` for primitive props.
- Disabled or constrained controls for `ReactNode` slots and class-name overrides.
- Props tables that help reviewers inspect the public API.

## Design Tokens

The primary token reference is `@mun.digital/tokens/metadata`, which is generated from `design.tokens.json` and used by docs and Storybook component documentation.

The generated CSS keeps `storybook-design-token` comment annotations for future compatibility, but the addon is not registered in public Storybook because its color presenter currently routes OKLCH values through `polished`, which cannot parse them reliably.

## Testing And Accessibility

The primary component and interaction path is the Storybook Vitest addon:

```bash
pnpm --filter @mun.digital/storybook test:storybook
```

Accessibility uses the Storybook test-runner against the static build so the same Storybook a11y parameters can fail the checked path:

```bash
pnpm --filter @mun.digital/storybook test:a11y
```

The a11y script builds static Storybook, serves it locally, and runs `test-storybook` against stories tagged for the current slice. `SectionHeader` sets `parameters.a11y.test = "error"` so accessibility violations fail the run.

Both Vitest browser mode and the test-runner require Playwright browser binaries to be available in the local or CI environment.

## Local MCP Boundary

Static Storybook deployment is public but noindexed. Local Storybook MCP support exists only through `@storybook/addon-mcp` while running Storybook locally. `storybook.mun.digital` does not expose or imply a live MCP endpoint.