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

Prop Type Default Description
type single | multiple single Allow one or multiple items open
class string - Additional CSS classes

AccordionItem

Prop Type Default Description
value string required Unique identifier for the item
class string - Additional CSS classes

AccordionTrigger

Prop Type Default Description
class string - Additional CSS classes

AccordionContent

Prop Type Default Description
class string - Additional CSS classes