Accordion

Vertically stacked, collapsible content sections. Use for organizing related content that can be progressively disclosed.

Setup

import { Accordion } from '@fragments-sdk/ui';

Examples

Basic

Single accordion with collapsible sections

Loading preview...

Multiple Open

Allows multiple sections to be open simultaneously

Loading preview...

With Disabled

Accordion with a disabled item

Loading preview...

Props

PropTypeDefaultDescription
typeenumsinglemultiplesingleWhether one or multiple items can be open
valueunionNot setControlled open item(s): string in single mode, string[] in multiple mode
defaultValueunionNot setInitially open item(s): string in single mode, string[] in multiple mode
onValueChangeunionNot setCalled when open items change (single: string | undefined, multiple: string[])
childrenRequirednodeNot setAccordion items (use Accordion.Item with Accordion.Trigger and Accordion.Content)
collapsiblebooleanfalseWhether all items can be closed (single mode only)
headingLevelunion234563Semantic heading level for accordion triggers

Usage Guidelines

When to use

  • FAQ pages with multiple questions and answers
  • Settings panels with grouped options
  • Long forms that benefit from progressive disclosure
  • Navigation menus with nested items

When not to use

  • Primary content that all users need to see
  • Very short content (just display inline)
  • Sequential steps (use Stepper or wizard)
  • Tab-like navigation (use Tabs instead)

Best practices

  • Keep section headers concise and descriptive
  • Use single mode when only one section should be open at a time
  • Use multiple mode when users may need to compare sections
  • Consider defaulting important sections to open
  • Avoid nesting accordions more than one level deep
Accessibility
  • Keyboard navigation with Enter/Space to toggle
  • Uses proper ARIA expanded/controls attributes
  • Focus is visible on accordion triggers