storybook/docs/snippets/html/button-story-using-args.js.mdx

27 lines
758 B
Plaintext

```js
// Button.stories.js
import { createButton } from './Button';
export default {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/html/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
};
//👇 We create a “template” of how args map to rendering
const Template = (args) => createButton(args);
//👇 Each story then reuses that template
export const Primary = Template.bind({});
Primary.args = { primary: true, label: 'Button' };
export const Secondary = Template.bind({});
Secondary.args = { ...Primary.args, label: '😄👍😍💯' };
export const Tertiary = Template.bind({});
Tertiary.args = { ...Primary.args, label: '📚📕📈🤓' };
```