fbredius/storybook

View on GitHub
docs/snippets/react/button-story-with-args.mdx.mdx

Summary

Maintainability
Test Coverage
```md
<!-- Button.stories.mdx-->

import { Meta, Story } from '@storybook/addon-docs';

import { Button } from './Button';

<Meta title="Button" component={Button} />

<!-- 👇 We create a “template” of how args map to rendering -->

export const Template = (args) => <Button {...args} />;

<!-- 👇 Each story then reuses that template -->
<Story
  name="Primary"
  args={{
    primary: true,
    label: 'Button',
  }}>
  {Template.bind({})}
</Story>
```