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