Back to Storybook

List Story With Unchecked Children

docs/_snippets/list-story-with-unchecked-children.md

10.3.62.7 KB
Original Source
jsx
import { List } from './List';

//๐Ÿ‘‡ Instead of importing ListItem, we import the stories
import { Unchecked } from './ListItem.stories';

export default {
  component: List,
};

export const OneItem = {
  args: {
    children: <Unchecked {...Unchecked.args} />,
  },
};
tsx
// Replace your-framework with the framework you are using, e.g. react-vite, nextjs, nextjs-vite, etc.
import type { Meta, StoryObj } from '@storybook/your-framework';

import { List } from './List';

//๐Ÿ‘‡ Instead of importing ListItem, we import the stories
import { Unchecked } from './ListItem.stories';

const meta = {
  component: List,
} satisfies Meta<typeof List>;

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

export const OneItem: Story = {
  args: {
    children: <Unchecked {...Unchecked.args} />,
  },
};
jsx
import { List } from './List';

//๐Ÿ‘‡ Instead of importing ListItem, we import the stories
import { Unchecked } from './ListItem.stories';

export default {
  component: List,
};

export const OneItem = {
  args: {
    children: <Unchecked {...Unchecked.args} />,
  },
};
tsx
import type { Meta, StoryObj } from 'storybook-solidjs-vite';

import { List } from './List';

//๐Ÿ‘‡ Instead of importing ListItem, we import the stories
import { Unchecked } from './ListItem.stories';

const meta = {
  component: List,
} satisfies Meta<typeof List>;

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

export const OneItem: Story = {
  args: {
    children: <Unchecked {...Unchecked.args} />,
  },
};
tsx
import preview from '../.storybook/preview';

import { List } from './List';

//๐Ÿ‘‡ Instead of importing ListItem, we import the stories
import { Unchecked } from './ListItem.stories';

const meta = preview.meta({
  component: List,
});

export const OneItem = meta.story({
  args: {
    children: <Unchecked {...Unchecked.input.args} />,
  },
});
<!-- JS snippets still needed while providing both CSF 3 & Next -->
jsx
import preview from '../.storybook/preview';

import { List } from './List';

//๐Ÿ‘‡ Instead of importing ListItem, we import the stories
import { Unchecked } from './ListItem.stories';

const meta = preview.meta({
  component: List,
});

export const OneItem = meta.story({
  args: {
    children: <Unchecked {...Unchecked.input.args} />,
  },
});