Component guideEditable source

Accordion

Expandable sections for related information, with single or multiple open items.

Original component docs
On this page4 sectionsBack to top

Use an accordion when readers need to scan several related sections and expand only the details they need. Use Collapsible for one independent disclosure. Each item needs a stable, unique value.

Live preview
Loading preview...

#Installation

Complete the base setup first. The CLI installs this item and its dependencies. For manual installation:

npx shadcn@latest add https://neobrutal-ui.andongmin.com/r/accordion.json

#Usage

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

export default function HelpSections() {
  return (
    <Accordion className="w-full">
      <AccordionItem value="source">
        <AccordionTrigger>Can I edit the source?</AccordionTrigger>
        <AccordionContent>Yes. Installed files belong to your application.</AccordionContent>
      </AccordionItem>
      <AccordionItem value="theme">
        <AccordionTrigger>Does it support dark mode?</AccordionTrigger>
        <AccordionContent>Use the matching light and dark theme tokens.</AccordionContent>
      </AccordionItem>
    </Accordion>
  );
}

#API reference

Prop / partPurposeDefault
value / defaultValueControlled or initial open item valuesUncontrolled
onValueChangeReceives the next open item values and event details—
multipleAllow more than one item to stay openfalse
AccordionItem.disabledDisables the sectionfalse
AccordionContent.keepMountedRetains closed panel DOMfalse

className accepts a string or a function of the part's Base UI state. On AccordionContent, both forms style the panel element; target its direct child to customize the inner padding.

#Accessibility

Write the section name in AccordionTrigger; it is a button inside a heading. Tab and Shift+Tab move through the triggers and controls in open panels. Enter and Space toggle the focused item. Base UI 1.8 does not use arrow-key, Home, or End navigation between accordion triggers; its deprecated loopFocus and orientation props do not change keyboard focus behavior. Do not nest another button or link inside the trigger. In controlled mode, treat the value as the array of currently open item values.