Skip to content

Story Structure

A story file follows a consistent structure: a meta object that configures the story, and one or more exported stories.

Basic Structure

typescript
import type { Meta, StoryObj } from "@storybook/react";

import UiMyComponent from "./UiMyComponent";

// Meta: configures the story
const meta = {
  title: "ui/Atoms/MyComponent",
  component: UiMyComponent,
} satisfies Meta<typeof UiMyComponent>;

export default meta;
type Story = StoryObj<typeof meta>;

// Story: a specific state of the component
export const Default: Story = {
  args: {
    label: "Hello",
  },
};

Meta Properties

PropertyPurpose
titlePath in the Storybook sidebar
componentThe component being documented
parametersStorybook configuration (layout, backgrounds...)
argTypesControls configuration for interactive props
decoratorsWrappers around the story for context
tagsLabels like beta, deprecated...