A shadcn-style accordion component built with Ark UI primitives.

Ark UI primitives styled like shadcn/ui—ready to paste into your app and theme with Tailwind.

Installation

npx shadcn@latest add @ark-cn/accordion

Usage

import {
  Accordion,
  AccordionItem,
  AccordionPanel,
  AccordionTrigger,
} from "@/components/ui/accordion"
<Accordion collapsible defaultValue={["item-1"]}>
  <AccordionItem value="item-1">
    <AccordionTrigger>Is it accessible?</AccordionTrigger>
    <AccordionPanel>
      Yes. It follows the WAI-ARIA accordion pattern via Ark UI.
    </AccordionPanel>
  </AccordionItem>
</Accordion>

Examples

Single item open

multiple defaults to false, so only one section is expanded at a time (unless you set multiple).

Only one section stays open at a time when multiple={false} (the default).

Multiple items open

Set multiple so more than one panel can stay open.

With multiple, more than one panel can be open at once.
Content for section B.

Controlled

Drive the open items with value and onValueChange.

The open items are driven by React state via value and onValueChange.

Open: open

Horizontal

Set orientation="horizontal" on the root for a row of triggers and side-by-side panels. Height is constrained by the styled root so width-based animations can run. Inner layout uses containerClassName on AccordionPanel so borders and padding stay on the content wrapper.

Use ArrowLeft and ArrowRight to move focus between triggers when orientation is horizontal.

Lazy mount

Combine lazyMount with unmountOnExit to defer rendering panel content until an item opens and remove it when it closes.

This panel mounts when opened. With unmountOnExit, it unmounts when collapsed so heavy children are not left in the tree.

Custom indicator

AccordionTrigger accepts an indicator prop that is not part of Ark’s ItemTrigger API—it replaces the default chevron. AccordionPanel supports containerClassName for the inner wrapper (see API reference).

Pass any ReactNode to the indicator prop on AccordionTrigger. Rotation styles still apply to the indicator wrapper.

API reference

Accordion, AccordionItem, AccordionTrigger, AccordionPanel, AccordionContext, AccordionProvider, and useAccordion mirror @ark-ui/react/accordion. All props and DOM behavior are defined by Ark unless you see an ark-cn-only row below.

AccordionTrigger and AccordionPanel add optional props on top of Ark’s ItemTrigger / ItemContent:

AccordionTrigger

PropTypeDescription
indicator?ReactNodeOptional node rendered inside ItemIndicator instead of the default ChevronDown icon.

AccordionPanel

PropTypeDescription
containerClassName?stringMerged onto the inner padded div that wraps children. Use Ark’s className on ItemContent for the animated outer shell; use containerClassName for inner padding, borders, and body layout.

See the ARK UI documentation for the full API.

Accessibility

See the Ark UI documentation for clarification (WAI-ARIA pattern, keyboard support, and orientation-specific notes).