Accordion
Stacked sections that open and close to show their content. Triggers are 56px tall with 16px text and a 20px chevron.
Installation
npx shadcn@latest add @sevenone/accordionUsage
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion"Examples
Default
Our flagship product combines cutting-edge technology with sleek design. Built with premium materials, it offers unparalleled performance and reliability.
<Accordion type="single" collapsible defaultValue="item-1">
<AccordionItem value="item-1">
<AccordionTrigger>Product Information</AccordionTrigger>
<AccordionContent>
Our flagship product combines cutting-edge technology with sleek design.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Shipping Details</AccordionTrigger>
<AccordionContent>We offer worldwide shipping.</AccordionContent>
</AccordionItem>
</Accordion>Multiple
With type="multiple", several sections can stay open at once.
Yes. It follows the WAI-ARIA pattern and works with the keyboard.
Yes. It uses the SevenOne tokens, so it follows your theme.
<Accordion type="multiple" defaultValue={["a", "b"]}>
…
<AccordionItem value="c" disabled>
<AccordionTrigger>Coming soon</AccordionTrigger>
<AccordionContent>This section is disabled.</AccordionContent>
</AccordionItem>
</Accordion>Accessibility
- Each trigger is a button inside a heading, so screen readers list the sections.
- Enter or Space opens and closes a section; Tab moves between triggers.
- The open and close animation turns off when people ask for reduced motion.