Summary
Set up Storybook 10 as the interactive component playground, deploy to storybook.vllnt.com, integrate with GitHub CI (Chromatic visual testing + PR checks), and embed stories in the registry app as live component previews — replacing the hard-coded ComponentPreview switch.
Motivation
The current component-preview.tsx is a 52KB file with a manual switch statement importing all 93+ components. Every new component requires manual wiring. Visual stories (.visual.tsx) are Playwright CT snapshot tests — non-interactive, no controls, no docs.
Storybook provides: interactive playground with controls, auto-generated docs from TypeScript props, visual regression testing via Chromatic, and iframe embedding — enabling zero-maintenance registry previews.
CURRENT TARGET
─────────────────── ───────────────────────────
Registry App Registry App
┌──────────────────┐ ┌──────────────────────┐
│ ComponentPreview │ │ ComponentPreview │
│ ┌──────────────┐ │ │ ┌─────────────────┐ │
│ │ switch(name) │ │ ────▶ │ │ <iframe src= │ │
│ │ case "btn": │ │ │ │ storybook. │ │
│ │ case "card": │ │ │ │ vllnt.com/... │ │
│ │ case x 93... │ │ │ │ /> │ │
│ └──────────────┘ │ │ └─────────────────┘ │
│ 52KB, manual │ │ ~2KB, auto-updates │
└──────────────────┘ └──────────────────────┘
Phase 1 — Storybook 10 Setup
Phase 2 — Stories for All Components
Phase 3 — Deploy to storybook.vllnt.com
Phase 4 — Chromatic Visual Testing + PR Checks
Phase 5 — Registry Embed (Replace ComponentPreview)
Phase 6 — Storybook Composition
Technical Notes
- Storybook 10: ESM-only, 29% smaller install, CSF Factories (TypeScript-first), RSC support, Next 16 + Vitest 4 compatible
- Tailwind setup: Import CSS in
.storybook/preview.tsx, Vite builder handles PostCSS automatically
- Radix primitives: No special config needed — just load CSS variables for theming
- Embed format:
https://storybook.vllnt.com/iframe.html?id={story-id}&viewMode=story&shortcuts=false&singleStory=true
- Chromatic free tier: 5k snapshots/month (Chrome only), OSS: 35k snapshots/month
References
Summary
Set up Storybook 10 as the interactive component playground, deploy to
storybook.vllnt.com, integrate with GitHub CI (Chromatic visual testing + PR checks), and embed stories in the registry app as live component previews — replacing the hard-codedComponentPreviewswitch.Motivation
The current
component-preview.tsxis a 52KB file with a manual switch statement importing all 93+ components. Every new component requires manual wiring. Visual stories (.visual.tsx) are Playwright CT snapshot tests — non-interactive, no controls, no docs.Storybook provides: interactive playground with controls, auto-generated docs from TypeScript props, visual regression testing via Chromatic, and iframe embedding — enabling zero-maintenance registry previews.
Phase 1 — Storybook 10 Setup
packages/ui/.storybook/styles.css+themes/default.cssinpreview.tsxstorybookandbuild-storybookscripts topackages/ui/package.jsonstorybooktask toturbo.json@storybook/addon-a11y— accessibility audit per story@storybook/addon-themes— dark/light toggle in toolbar@storybook/addon-storysource— show story source code@storybook/addon-viewport— responsive viewport testing@storybook/addon-interactions— test interactions in stories@etchteam/storybook-addon-github-link— "View on GitHub" per story (baseURL: https://github.com/vllnt/ui/blob/main/packages/ui/src)Phase 2 — Stories for All Components
{name}/{name}.stories.tsx(coexists with existing.visual.tsxPlaywright tests).visual.tsxcoverage at minimum)pnpm storybook:generatescript to scaffold.stories.tsxstubs from component exportssrc/index.tshas at least one storyPhase 3 — Deploy to
storybook.vllnt.com.github/workflows/storybook.yml)bitovi/github-actions-storybook-to-github-pagesaction (or Vercel/Cloudflare for subdomain)storybook.vllnt.comon push tomainnode_modules+.storybook-cachePhase 4 — Chromatic Visual Testing + PR Checks
@chromatic-com/storybookaddonchromaui/actionGitHub Action (.github/workflows/chromatic.yml)Phase 5 — Registry Embed (Replace ComponentPreview)
component-preview.tsxswitch with Storybook iframe embed<iframe src="https://storybook.vllnt.com/iframe.html?id=components-{name}--default&viewMode=story&shortcuts=false&singleStory=true" />ComponentPreviewiframe wrapper with:globals=theme:darkURL param)components-{name}--default(derived from registry slug)ComponentPreviewfor local dev when Storybook not deployedPhase 6 — Storybook Composition
refsin.storybook/main.tsso consumers can compose@vllnt/uistories into their own Storybook@vllnt/uiStorybook from external projectsTechnical Notes
.storybook/preview.tsx, Vite builder handles PostCSS automaticallyhttps://storybook.vllnt.com/iframe.html?id={story-id}&viewMode=story&shortcuts=false&singleStory=trueReferences