Accordion

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

Installation

pnpm dlx stera-ui add accordion

Usage

import {
  Accordion,
  AccordionItem,
  AccordionTrigger,
  AccordionContent,
} from "@/components/ui/accordion"
<Accordion>
  <AccordionItem value="item-1">
    <AccordionTrigger>Section title</AccordionTrigger>
    <AccordionContent>Section content goes here.</AccordionContent>
  </AccordionItem>
</Accordion>

Multiple Open

Pass multiple to allow more than one item to be expanded at a time.

Default Open

This item is open by default on first render.

Use defaultValue with an array of item values to pre-expand items on first render.

API Reference

Accordion

PropTypeDefault
multiplebooleanfalse
defaultValuestring[][]
valuestring[]
onValueChange(value: string[]) => void

AccordionItem

PropTypeDefault
valuestring
disabledbooleanfalse