import type { Meta, StoryObj } from '@storybook/vue3-vite' import { ref } from 'vue' import ToggleGroup from './ToggleGroup.vue' import ToggleGroupItem from './ToggleGroupItem.vue' const meta = { title: 'Components/ToggleGroup', component: ToggleGroup, tags: ['autodocs'], argTypes: { type: { control: 'select', options: ['single', 'multiple'], description: 'Single or multiple selection' }, variant: { control: 'select', options: ['default', 'outline'], description: 'Visual style variant' }, disabled: { control: 'boolean', description: 'When true, disables the toggle group' }, 'onUpdate:modelValue': { action: 'update:modelValue' } } } satisfies Meta export default meta type Story = StoryObj export const Default: Story = { render: (args) => ({ components: { ToggleGroup, ToggleGroupItem }, setup() { const value = ref('center') return { value, args } }, template: ` Left Center Right
Selected: {{ value || 'None' }}
` }), args: { variant: 'default', disabled: false } } export const Disabled: Story = { render: (args) => ({ components: { ToggleGroup, ToggleGroupItem }, setup() { const value = ref('on') return { value, args } }, template: ` Off On ` }), args: {} } export const OutlineVariant: Story = { render: (args) => ({ components: { ToggleGroup, ToggleGroupItem }, setup() { const value = ref('medium') return { value, args } }, template: ` Small Medium Large ` }), args: {} } export const BooleanToggle: Story = { render: (args) => ({ components: { ToggleGroup, ToggleGroupItem }, setup() { const value = ref('off') return { value, args } }, template: `

Boolean toggle with custom labels:

Outside Inside
Value: {{ value === 'on' ? true : false }}
` }), args: {} } export const LongLabels: Story = { render: (args) => ({ components: { ToggleGroup, ToggleGroupItem }, setup() { const value = ref('option1') return { value, args } }, template: `

Labels truncate with ellipsis:

Very Long Label One Another Long Label
` }), args: {} } export const Sizes: Story = { render: () => ({ components: { ToggleGroup, ToggleGroupItem }, setup() { const sm = ref('a') const md = ref('a') const lg = ref('a') return { sm, md, lg } }, template: `

Small:

A B

Default:

A B

Large:

A B
` }) }