40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import type { Meta, StoryObj } from 'storybook-react-rsbuild';
|
|
import { Select } from '../components/ui';
|
|
|
|
const items = [
|
|
{ value: 'sequoia', label: 'Sequoia' },
|
|
{ value: 'sonoma', label: 'Sonoma' },
|
|
{ value: 'ventura', label: 'Ventura' },
|
|
{ value: 'monterey', label: 'Monterey' },
|
|
];
|
|
|
|
const meta = {
|
|
title: 'Inputs/Select',
|
|
component: Select,
|
|
parameters: {
|
|
docs: {
|
|
description: {
|
|
component:
|
|
'Radix Select in the ModernSK skin. Pass `items` plus an optional `placeholder`; control it with `value` / `onValueChange` or leave it uncontrolled with `defaultValue`.',
|
|
},
|
|
},
|
|
},
|
|
argTypes: {
|
|
items: { control: false },
|
|
placeholder: { control: 'text' },
|
|
disabled: { control: 'boolean' },
|
|
defaultValue: { control: 'text' },
|
|
value: { control: 'text' },
|
|
onValueChange: { action: 'value changed' },
|
|
'aria-label': { control: 'text' },
|
|
},
|
|
args: { items, placeholder: 'Pick a release…', 'aria-label': 'macOS release' },
|
|
} satisfies Meta<typeof Select>;
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const Playground: Story = {};
|
|
|
|
export const WithDefault: Story = { args: { defaultValue: 'sonoma' } };
|