← ClaudeAtlas

clawic-storybooklisted

Build component stories with proper args, controls, decorators, and testing patterns.
trku052-png/social-media-youtube-skills · ★ 1 · AI & Automation · score 68
Install: claude install-skill trku052-png/social-media-youtube-skills
## CSF Format (Component Story Format) - Default export is component meta—title, component, args, decorators - Named exports are stories—each export becomes a story in sidebar - `satisfies Meta<typeof Component>` for TypeScript type checking - CSF3 uses object syntax, not functions—`export const Primary = { args: {...} }` ## Args vs ArgTypes - `args` are actual prop values passed to component—`args: { label: 'Click me' }` - `argTypes` configure controls UI—`argTypes: { size: { control: 'select', options: ['sm', 'lg'] } }` - Default args in meta apply to all stories—override in individual stories - `argTypes: { onClick: { action: 'clicked' } }` logs events in Actions panel ## Controls - Auto-inferred from TypeScript props—boolean becomes toggle, string becomes text input - Override control type: `argTypes: { color: { control: 'color' } }` - Disable control: `argTypes: { children: { control: false } }` - Options for select: `control: { type: 'select' }, options: ['a', 'b', 'c']` ## Decorators - Wrap stories with context—providers, layout wrappers, theme - Component-level in meta: `decorators: [(Story) => <Provider><Story /></Provider>]` - Global in `.storybook/preview.js`: applies to all stories - Order matters—later decorators wrap earlier ones ## Play Functions - Interactive testing within story: `play: async ({ canvasElement }) => {...}` - Use `@storybook/testing-library` for queries—`within(canvasElement).getByRole()` - `await userEvent.click(button)` for interacti