mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 07:32:02 +08:00
35 lines
1012 B
Plaintext
35 lines
1012 B
Plaintext
```ts
|
|
// Button.stories.ts
|
|
|
|
import type { Meta, StoryObj } from '@storybook/html';
|
|
import { createButton, ButtonArgs } from './Button';
|
|
|
|
const meta: Meta<ButtonArgs> = {
|
|
/* 👇 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',
|
|
};
|
|
|
|
export default meta;
|
|
type Story = StoryObj<ButtonArgs>;
|
|
|
|
/*
|
|
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
|
|
* See https://storybook.js.org/docs/7.0/html/api/csf
|
|
* to learn how to use render functions.
|
|
*/
|
|
export const Primary: Story = {
|
|
render: (args) => createButton({ backgroundColor: '#ff0', label: 'Button' }),
|
|
};
|
|
|
|
export const Secondary: Story = {
|
|
render: (args) => createButton({ backgroundColor: '#ff0', label: '😄👍😍💯' }),
|
|
};
|
|
|
|
export const Tertiary: Story = {
|
|
render: (args) => createButton({ backgroundColor: '#ff0', label: '📚📕📈🤓' }),
|
|
};
|
|
```
|