Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Accordion examples · Tabs

Tab-Style Accordion with Left Chevron for React

An accordion of security questions drawn as separate rounded cards, with the chevron at the start of each trigger.

Framework
UI library

Separate rounded cards with the chevron in front. This React accordion reverses each trigger's row so the built-in chevron comes before the security question, and the cards keep a gap between them. Use it for settings and navigation panels where the toggle should lead.

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

How are the sections separated?

Accordion is flex flex-col gap-2. Each AccordionItem has its own rounded-lg border, with no horizontal padding on the item.

How does the chevron move to the start of the card?

flex-row-reverse on AccordionTrigger places the built-in chevron before the title, with gap-3 between them. The trigger sets px-4 py-3 and hover:no-underline, and the title is flex-1 text-start.

Why does the answer use ps-11?

ps-11 lines the answer up under the title: the trigger padding, the chevron, and gap-3. The content also sets px-4 and pb-4.

Why does the single sign-on question start open?

defaultValue={["sso"]} opens the single sign-on question on first render. The string matches that item's value.

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 list every item that should start open in the defaultValue array.

Is keyboard navigation built in?

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.