Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Accordion

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

Installation

npx logic2b@latest add accordion

Usage

import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger,
} from "@/components/ui/accordion"

<Accordion type="single" collapsible>
  <AccordionItem value="item-1">
    <AccordionTrigger>Is it accessible?</AccordionTrigger>
    <AccordionContent>
      Yes. It adheres to the WAI-ARIA design pattern.
    </AccordionContent>
  </AccordionItem>
</Accordion>

API

Prop Type Default
type (Accordion) single | multiple
collapsible (Accordion) boolean — allow closing the open item (single mode) false
value / defaultValue (Accordion) string | string[] — controlled/uncontrolled open item(s)
onValueChange (Accordion) (value: string | string[]) => void
disabled (Accordion / AccordionItem) boolean false
value (AccordionItem) string — unique item id (required)

Examples

Multiple

Set type="multiple" to let more than one section stay open at a time.

Controlled

Drive the open item externally with value and onValueChange.

The open item is driven by external state.

Accessibility

  • Follows the WAI-ARIA Accordion pattern.
  • Space or Enter toggles the focused section.
  • Arrow Up / Arrow Down move focus between triggers, and Home / End jump to the first/last.
  • Each trigger sits inside a heading and exposes aria-expanded and aria-controls linking it to its panel.