import type { Meta, StoryObj } from '@storybook/web-components-vite'; import { html } from 'lit'; import './index.ts'; import type { USACheckbox } from './usa-checkbox.js'; const meta: Meta = { title: 'Forms/Checkbox', component: 'usa-checkbox', parameters: { layout: 'padded', docs: { description: { component: ` The USA Checkbox component provides accessible checkbox selection using official USWDS styling. Perfect for government applications requiring multiple selections, feature toggles, and user preferences. **Government Use Cases:** - Multi-select options in federal forms - Feature preferences and notification settings - Terms acceptance and compliance checkboxes - Data collection consent forms - Service selection in government portals - Accessibility compliance demonstrations `, }, }, }, argTypes: { label: { control: 'text', description: 'Label text for the checkbox', }, value: { control: 'text', description: 'Checkbox value when checked', }, checked: { control: 'boolean', description: 'Whether the checkbox is checked', }, description: { control: 'text', description: 'Description text (shown below label)', }, disabled: { control: 'boolean', description: 'Whether the checkbox is disabled', }, required: { control: 'boolean', description: 'Whether the checkbox is required', }, indeterminate: { control: 'boolean', description: 'Whether the checkbox is in indeterminate state', }, tile: { control: 'boolean', description: 'Whether to use the tile variant', }, error: { control: 'text', description: 'Error message (shows error state)', }, }, args: { label: 'Checkbox label', value: 'checkbox-value', checked: false, description: '', disabled: false, required: false, indeterminate: false, tile: false, error: '', }, }; export default meta; type Story = StoryObj; // Basic Examples export const Default: Story = { args: { label: 'Standard checkbox', value: 'standard', }, }; export const Checked: Story = { args: { label: 'Pre-selected checkbox', value: 'selected', checked: true, }, }; export const WithDescription: Story = { args: { label: 'Checkbox with description', value: 'with-desc', description: 'Additional context provided below the label', }, }; export const Disabled: Story = { args: { label: 'Disabled checkbox', value: 'disabled', disabled: true, }, }; export const DisabledChecked: Story = { args: { label: 'Disabled and checked', value: 'disabled-checked', disabled: true, checked: true, }, }; export const Indeterminate: Story = { args: { label: 'Indeterminate state', value: 'indeterminate', indeterminate: true, }, }; export const Required: Story = { args: { label: 'Required checkbox', value: 'required', required: true, }, }; export const ErrorState: Story = { args: { label: 'Checkbox with error', value: 'error', required: true, error: 'This field is required', }, }; export const TileVariant: Story = { args: { label: 'Tile Checkbox', value: 'tile', description: 'Enhanced checkbox with larger touch target and description support', tile: true, }, }; // Group examples export const CheckboxGroup: Story = { parameters: { controls: { disable: true }, // Static demo - no interactive controls needed }, render: () => html`

Checkbox Group

Multiple checkbox selections with fieldset grouping.

Select your preferences:
`, }; export const TileVariantGroup: Story = { parameters: { controls: { disable: true }, // Static demo - no interactive controls needed }, render: () => html`

Service Selection (Tile Variant)

Tile checkboxes for enhanced service selection with detailed descriptions.

Select Services
`, }; export const AccessibilityDemo: Story = { parameters: { controls: { disable: true }, // Static demo - no interactive controls needed }, render: () => html`

Accessibility Features

Checkbox component meeting accessibility requirements.

Accessibility Preferences

Accessibility Features:

  • Keyboard Navigation: Tab and Space key support
  • Screen Reader Support: Proper ARIA labels and announcements
  • Color Contrast: Meets contrast requirements
  • Focus Indicators: Clear visual focus indicators
  • Label Association: Proper labels and descriptions
`, };