Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Accordion examples · Standard

Standard Accordion with Chevron for React

A bordered accordion of three questions, one open at a time, with the built-in chevron on the right of each trigger.

Framework
UI library

Sometimes you just need a clean accordion without the extras. This React accordion stacks three questions in bordered rows, with the chevron that AccordionTrigger draws on the right and the first answer open. On Base UI, opening one item closes the other, which suits FAQs, settings panels and help sections where one answer at a time is enough.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

When should I use a standard accordion vs other variants?

Use it when the headings explain themselves and the content is a paragraph or two: an FAQ, a settings group, a help section. Reach for icons or subtitles when people need more to go on before they open an item, and for a nested layout when sections hold sub-topics.

How do I let several items stay open at once?

One open item is the default. Add multiple to Accordion to let several stay open, and pass every item to open first in the defaultValue array.

How do I customize the border and spacing?

Each AccordionItem gets a full border, and -space-y-px on Accordion pulls the items up by one pixel so neighboring borders overlap into a single line. first:rounded-t-lg and last:rounded-b-lg round the outer corners. Change px-4 on the items for more room, or drop the borders for a flat list.

Can I change the chevron icon?

AccordionTrigger draws its own chevron, a down arrow that turns into an up arrow when the item opens. Both icons have data-slot="accordion-trigger-icon", so **:data-[slot=accordion-trigger-icon]:hidden on a trigger hides them and you can put your own icon in the trigger. To change the icon everywhere, edit it in components/ui/accordion.

How do I control the expand/collapse animation speed?

The height animation lives in AccordionContent in components/ui/accordion, so that's where to change its duration or easing. Users who ask for reduced motion should still get an instant toggle, so keep the animation short.

Is keyboard navigation built in with Base UI?

Yes. Each trigger is a button with aria-expanded and aria-controls, and Enter or Space toggles it. The arrow keys move between triggers, and Home and End jump to the first and last.