2026-02-02 18:37:52 +00:00
|
|
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
|
|
|
import { Switch } from './switch';
|
|
|
|
|
|
|
|
|
|
const meta = {
|
|
|
|
|
title: 'UI/Switch',
|
|
|
|
|
component: Switch,
|
|
|
|
|
tags: ['autodocs'],
|
|
|
|
|
argTypes: {
|
|
|
|
|
checked: { control: 'boolean' },
|
|
|
|
|
disabled: { control: 'boolean' },
|
|
|
|
|
},
|
|
|
|
|
args: {
|
|
|
|
|
onCheckedChange: () => { },
|
|
|
|
|
}
|
|
|
|
|
} satisfies Meta<typeof Switch>;
|
|
|
|
|
|
|
|
|
|
export default meta;
|
|
|
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
|
|
|
|
|
|
export const Default: Story = {
|
|
|
|
|
args: {
|
|
|
|
|
checked: false,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const Checked: Story = {
|
|
|
|
|
args: {
|
|
|
|
|
checked: true,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const Disabled: Story = {
|
|
|
|
|
args: {
|
|
|
|
|
disabled: true,
|
|
|
|
|
checked: false,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const DisabledChecked: Story = {
|
|
|
|
|
args: {
|
|
|
|
|
disabled: true,
|
|
|
|
|
checked: true,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const WithLabel: Story = {
|
|
|
|
|
render: (args) => (
|
|
|
|
|
<div className="flex items-center space-x-2">
|
|
|
|
|
<Switch id="airplane-mode" {...args} />
|
2026-02-12 01:09:29 +00:00
|
|
|
<label htmlFor="airplane-mode" className="text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
|
2026-02-02 18:37:52 +00:00
|
|
|
Airplane Mode
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
),
|
|
|
|
|
};
|