Import
Basic Usage
Key Features
- Controlled or Uncontrolled: Use
valueandonValueChangefor controlled state, ordefaultValuefor uncontrolled. - Multiple Expansion: Set
multipleprop to allow multiple panels to be open simultaneously. - Keyboard Navigation: Full arrow key navigation with optional
loopFocusbehavior. - Orientation Support: Configure as
verticalorhorizontalto control keyboard navigation. - Accessibility: Built-in ARIA attributes and proper semantic structure.
- Keep Mounted: Control whether panels stay in the DOM when closed with
keepMounted. - Hidden Until Found: Enable browser’s page search to find and expand panels with
hiddenUntilFound.
Components
Accordion.Root
The root container that manages accordion state. Props:value- Controlled array of open item valuesdefaultValue- Initial array of open item values (uncontrolled)onValueChange- Callback when items are expanded/collapsedmultiple- Allow multiple items open at once (default:false)disabled- Disable all user interaction (default:false)orientation- Visual orientation:'vertical'or'horizontal'(default:'vertical')loopFocus- Loop focus when reaching end with arrow keys (default:true)keepMounted- Keep panels in DOM when closed (default:false)hiddenUntilFound- Allow browser search to expand panels (default:false)
Accordion.Item
Groups an accordion header with its corresponding panel. Props:value- Unique identifier for this itemdisabled- Disable this specific itemonOpenChange- Callback when this item is opened/closed
Accordion.Header
A heading element that labels the panel. Renders an<h3> element by default.
Accordion.Trigger
A button that toggles the panel. Renders a<button> element.
Props:
disabled- Disable the trigger buttonnativeButton- Use native button behavior (default:true)
Accordion.Panel
The collapsible panel containing the content. Renders a<div> element.
Props:
keepMounted- Keep this panel in DOM when closedhiddenUntilFound- Allow browser search for this panel