button.stories.ts
1 import type { Meta, StoryObj } from '@storybook/react-vite' 2 import { fn } from 'storybook/test' 3 4 import { Button } from './button' 5 6 const meta = { 7 title: 'Form/Button', 8 component: Button, 9 parameters: { 10 layout: 'centered', 11 }, 12 tags: ['autodocs'], 13 args: { onClick: fn() }, 14 } satisfies Meta<typeof Button> 15 16 export default meta 17 type Story = StoryObj<typeof meta> 18 19 export const Primary: Story = { 20 args: { 21 variant: 'primary', 22 children: 'Primary Button', 23 }, 24 } 25 26 export const Secondary: Story = { 27 args: { 28 variant: 'secondary', 29 children: 'Secondary Button', 30 }, 31 } 32 33 export const Danger: Story = { 34 args: { 35 variant: 'danger', 36 children: 'Delete Account', 37 }, 38 } 39 40 export const Small: Story = { 41 args: { 42 size: 'small', 43 children: 'Small Button', 44 }, 45 } 46 47 export const Medium: Story = { 48 args: { 49 size: 'medium', 50 children: 'Medium Button', 51 }, 52 } 53 54 export const Large: Story = { 55 args: { 56 size: 'large', 57 children: 'Large Button', 58 }, 59 } 60 61 export const Disabled: Story = { 62 args: { 63 variant: 'primary', 64 children: 'Disabled Button', 65 disabled: true, 66 }, 67 }