Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Accordion with Left Chevron for Solid

A shipping FAQ with the chevron before each question. When will my order ship? starts open.

UI library: Ark UI

Four shipping questions in a bordered stack. The chevron sits before the title, and When will my order ship? starts open. The answers line up under the titles.

Use it when the toggle should lead, like a tree. A single question can be a Collapsible. In Solid, Ark UI opens one question at a time in this demo.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Accordion anatomy: root, item, item trigger, item content, item indicator

Usage

<Accordion class="w-full max-w-md -space-y-px" defaultValue={["shipping"]}>
    {items.map(item => <AccordionItem class="overflow-hidden border bg-background first:rounded-t-lg last:rounded-b-lg" value={item.value}>
        <AccordionTrigger class="flex-row-reverse gap-3 px-4 py-3 hover:no-underline">
          <span class="flex-1 text-start">{item.title}</span>
        </AccordionTrigger>
        <AccordionContent class="px-4 ps-11 pb-4">
          <p class="text-muted-foreground">{item.content}</p>
        </AccordionContent>
      </AccordionItem>)}
  </Accordion>

FAQ

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

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

Why does the answer use ps-11?

ps-11 lines the answer up under the title: the trigger padding, the chevron, and gap-3. px-4 on AccordionContent sets the end padding, ps-11 sets the start, and pb-4 pads the bottom.

Why does the shipping question start open?

defaultValue={["shipping"]} opens the shipping 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.

How do the row borders meet?

-space-y-px on Accordion makes neighboring borders share one line. Each AccordionItem has border, first:rounded-t-lg and last:rounded-b-lg. Horizontal padding is on the trigger and the content.

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.

API Reference

Accordion

Sets defaultValue={["shipping"]} and value={item.value}. The rest is on the Accordion page.