GitHub 604

Accordion

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

Installation

npx shadcn@latest add @fulldev/accordion

Usage

import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger,
} from "@/components/ui/accordion"
<Accordion>
  <AccordionItem value="item-1">
    <AccordionTrigger>Is it accessible?</AccordionTrigger>
    <AccordionContent>
      Yes. It adheres to the WAI-ARIA design pattern.
    </AccordionContent>
  </AccordionItem>
</Accordion>

Composition

Use the following composition to build an Accordion:

Accordion
├── AccordionItem
│   ├── AccordionTrigger
│   └── AccordionContent
└── AccordionItem
    ├── AccordionTrigger
    └── AccordionContent

Examples

Multiple

Use the multiple prop to allow multiple items to be open at the same time.

With Disabled

Use the disabled prop on AccordionItem to disable individual items.

With Borders

Add border to the Accordion and border-b last:border-b-0 to the AccordionItem to add borders to the items.

In Card

Wrap the Accordion in a Card component.

API Reference

See the GitHub source code for more information on props. See the data-slot docs for more information on interactivity.