Skip to content

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

Tab-Style Accordion with Left Chevron for Vue

Security questions as separate rounded cards, with the chevron before the title. Single sign-on starts open.

UI library: Ark UI

Four security questions, each a rounded card. The chevron sits before the title, and Do you support single sign-on? starts open.

Use it when the toggle should lead and each topic is its own card. A single security note can be an Alert. In Vue, Ark UI does not remember which card was open.

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="flex w-full max-w-md flex-col gap-2" :defaultValue='["sso"]'>
  <AccordionItem
    v-for="item in items"
    class="overflow-hidden rounded-lg border bg-background"
    :key="item.value"
    :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 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.

API Reference

Accordion

Sets defaultValue="[sso]", v-for="item in items", key="item.value" and value="item.value". The rest is on the Accordion page.