Storybook — everyday & advanced
EverydayControls & args
Define argTypes so designers/devs can poke props in the UI:
tsx
const meta = {
component: Button,
argTypes: {
variant: {
control: 'select',
options: ['primary', 'secondary', 'ghost'],
},
},
} satisfies Meta<typeof Button>Decorators (providers)
tsx
const meta = {
decorators: [
(Story) => (
<ThemeProvider>
<Story />
</ThemeProvider>
),
],
} satisfies MetaDocs
tags: ['autodocs']generates docs from component + stories- Write MDX docs only when autodocs isn’t enough
Accessibility
bash
# if not already added by init for your version
npm i -D @storybook/addon-a11yEnable the a11y panel; fix issues before they hit HubSpot/WP/production.
Composition / design system publish
bash
npm run build-storybook
# deploy storybook-static/ to Cloudflare Pages or internal static hostTips
- Stories should not hit real production APIs — mock
- Keep stories next to components (
Button.tsx+Button.stories.tsx) - Visual regression (Chromatic / Playwright) when the library is shared