Storybook Story Builder

Generate a Storybook CSF story file for a React or Vue component

Create a Storybook Component Story Format (CSF3) file with a typed Meta default export, a StoryObj type, and multiple named story exports each carrying args for common component states like primary, disabled, and large.

What is CSF3 and how is it different from older formats?

Component Story Format 3 represents each story as an object with args rather than a render function. It is less boilerplate than CSF2, supports automatic controls from args, and is the recommended format in modern Storybook.

Storybook stories without retyping the boilerplate

Storybook documents a component by rendering it in different states, each one a “story”. In the modern Component Story Format (CSF3), a file exports a typed Meta default and then one object per state with args. The shape is mechanical, so this builder generates it from a component name and a list of states.

How it works

The tool writes a .stories.tsx file. It imports Meta and StoryObj types from the framework package (@storybook/react or @storybook/vue3), imports your component, and exports a const meta: Meta<typeof Component> default with the title and component set plus tags: ['autodocs']. It defines type Story = StoryObj<typeof Component> and then emits one export const Name: Story = { args: { ... } } per state you list. Common states (Primary, Secondary, Disabled, Large) get sensible default args; any custom names get an empty args object for you to fill.

Tips and example

  • Use slash-delimited titles like Forms/Input to nest stories in the sidebar.
  • Keep tags: ['autodocs'] so Storybook auto-generates a docs page from your args.
  • Put only the props that change in each story’s args; shared defaults can live in meta.args.
import type { Meta, StoryObj } from "@storybook/react";
import { Button } from "./Button";

const meta: Meta<typeof Button> = {
  title: "Components/Button",
  component: Button,
  tags: ["autodocs"],
};
export default meta;

type Story = StoryObj<typeof Button>;

export const Primary: Story = { args: { variant: "primary", label: "Button" } };
export const Disabled: Story = { args: { disabled: true, label: "Button" } };