Accordion

A vertically stacked set of interactive headings that each reveal an associated section of content.

Yes. It adheres to the WAI-ARIA design pattern. Keyboard interactions and ARIA attributes have been implemented.

Yes, the component accepts className props that can be used to override styles. It also comes with built-in size variants.

Absolutely! The Accordion component adjusts to different screen sizes and can be used in various layouts.

This component inherits parts and props from the Radix Accordion primitive. View source

Contains all the parts of an accordion. It supports multiple open items by default.

PropTypeDefault
size"1" | "2""2"
valuestring[][]
defaultValuestring[][]
onValueChange(value: string[]) => void

The Root component also supports common margin props m, mx, my, ml, mr, mt, mb.

Contains all the parts of a collapsible section.

PropTypeDefault
valuestringRequired

Contains the trigger for a collapsible section. This component is based on a heading element.

PropTypeDefault
as"h1" | "h2" | "h3" | "h4" | "h5" | "h6""h3"

Contains the content to be revealed when the accordion item is expanded.

PropTypeDefault
hiddenUntilFoundbooleantrue

The Accordion component comes with two size variants.

This accordion uses the smaller size variant.

This accordion uses the default size variant.

You can customize the heading level used in the accordion header.

Using the appropriate heading level is important for accessibility and document structure.

You can choose the heading level that makes the most sense for your page structure.