basecn
Components

Accordion

A set of collapsible panels with headings.

Our flagship product combines cutting-edge technology with sleek design. Built with premium materials, it offers unparalleled performance and reliability.

Key features include advanced processing capabilities, and an intuitive user interface designed for both beginners and experts.

Installation

pnpm dlx shadcn@latest add https://basecn.dev/r/accordion.json

Examples

Tabs

Our flagship product combines cutting-edge technology with sleek design. Built with premium materials, it offers unparalleled performance and reliability.

With Icon

Our flagship product combines cutting-edge technology with sleek design. Built with premium materials, it offers unparalleled performance and reliability.

With Plus Minus Indicator

Our flagship product combines cutting-edge technology with sleek design. Built with premium materials, it offers unparalleled performance and reliability.

Multiple Items Open

Our flagship product combines cutting-edge technology with sleek design. Built with premium materials, it offers unparalleled performance and reliability.

Migrating from Radix UI

Common Migration Steps

All components share several migration patterns when moving from Radix UI to Base UI. Before proceeding with component-specific changes, review the essential migration patterns.

Familiarizing yourself with these patterns will make the component-specific migration steps much clearer.

Accordion Type

In Radix UI, you can pass the type prop to the Accordion component to change the accordion type to either single or multiple.

import { Accordion, 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>

With Base UI, you can pass the boolean openMultiple prop to the Accordion component to control the accordion type. When openMultiple is true, the accordion behaves as type multiple; when false, it behaves as type single.

The default value for openMultiple is true.

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

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