bearnie

Accordion

Expandable sections that reveal content one at a time.

Installation

npx bearnie add accordion
npx bearnie add accordion

Usage

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

Examples

Multiple

Multiple items can be open simultaneously. Useful when users may need to compare content across sections.

With Icon

Add icons to accordion triggers to provide visual context for each section.

With Description

Add a subtitle or description below the main trigger text for additional context.

With Icon and Description

Combine icons with descriptions for a rich, informative accordion header.

Nested Accordions

Accordions can be nested inside each other for hierarchical content organization.

Rich Content

Accordion content can contain any elements including lists, badges, buttons, and more.

Borderless

Remove borders for a cleaner, minimal look.

Grouped

Wrap accordion items in a bordered container for a unified, grouped appearance.

Card Style

Style accordion items as separate cards with rounded corners and background.

Anatomy

  • Accordion - The root container that manages state
  • AccordionItem - Individual collapsible section wrapper
  • AccordionTrigger - The clickable header that toggles content
  • AccordionContent - The expandable content panel

Props

Accordion

PropTypeDefaultDescription
typesingle | multiplesingleAllow one or multiple items open
classstring-Additional CSS classes

AccordionItem

PropTypeDefaultDescription
valuestringrequiredUnique identifier for the item
classstring-Additional CSS classes

AccordionTrigger

PropTypeDefaultDescription
classstring-Additional CSS classes

AccordionContent

PropTypeDefaultDescription
classstring-Additional CSS classes