Accordion

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

Installation

$ npx shadcn@latest add "/r/accordion.json"

Usage

Multiple Items Open

Use type="multiple" to allow multiple items to be open at once.

Content for the first section.

Content for the second section.

Props

Accordion

PropTypeDefaultDescription
type"single" | "multiple""single"Whether one or multiple items can be open at once.
defaultValuestring | string[]-The value of the item(s) to open by default.
valuestring | string[]-The controlled value of the open item(s).
onValueChange(value: string | string[]) => void-Callback when the open item(s) change.

AccordionItem

PropTypeDefaultDescription
valuestringRequiredA unique value for the item.
disabledbooleanfalseWhether the item is disabled.

AccordionTrigger

PropTypeDefaultDescription
classNamestring-Additional CSS classes.

AccordionPanel

PropTypeDefaultDescription
classNamestring-Additional CSS classes.