import type { Meta, StoryObj } from '@storybook/react-vite'; import { Tabs, TabsContent, TabsList, TabsTrigger } from './tabs'; const meta = { title: 'Components/Tabs', component: Tabs, parameters: { layout: 'centered', docs: { description: { component: 'Switches between sibling panels without leaving the page. Tabs are for alternate views of the same subject — if the panels are separate destinations, use links and routes so they can be shared and bookmarked.\n\nThe shape is set once on `TabsList` (`variant`, `size`, `colorPalette`) and the triggers read it back, so nothing has to be repeated per tab. CBAR also draws a `state` axis — hover, active, disabled — which is *not* a prop here: those are CSS states, and making them props would let a tab look selected without being selected.', }, }, }, tags: ['autodocs'], } satisfies Meta; export default meta; type Story = StoryObj; const panels = { overview: 'Traffic, conversion and revenue for the last 30 days.', activity: 'Everything that happened in this project recently.', settings: 'Project name, visibility and danger zone.', }; export const Default: Story = { render: () => ( Overview Activity Settings {Object.entries(panels).map(([value, text]) => ( {text} ))} ), }; /** CBAR's four strips. `default` is the kit's older segmented control. */ export const Variants: Story = { render: () => (
{(['line', 'subtle', 'outline', 'plain', 'default'] as const).map((variant) => ( Overview Activity Settings {variant} ))}
), }; /** `md` is 36px tall, `lg` 44px — CBAR's two rungs. */ export const Sizes: Story = { render: () => (
{(['md', 'lg'] as const).map((size) => ( Overview Activity size {size} ))}
), }; /** The strip takes any palette; hover sits one step below the selected fill. */ export const Palettes: Story = { render: () => (
{(['secondary', 'primary', 'green', 'red'] as const).map((palette) => ( Overview Activity Settings {palette} ))}
), }; export const Vertical: Story = { render: () => ( Overview Activity Settings {Object.entries(panels).map(([value, text]) => ( {text} ))} ), }; export const WithDisabledTab: Story = { render: () => ( Overview Billing Billing is only available on paid plans. ), };