Accordion
Vertically stacked, expandable sections that reveal one panel at a time (or many, if you allow it). Built on Radix Accordion. Each section shows a caret that rotates on open.
Anatomy
- 1Accordion (root)
Radix root that owns the open state. Requires type="single" (one panel open) or type="multiple" (many).
- 2AccordionItem
One section. Needs a unique value string. Renders a bottom border to separate from siblings.
- 3AccordionTrigger
The clickable header row (py-4, text-sm, font-medium, text-foreground). Focus ring 3px ring-ring/50 rounded-md, active:opacity-60 pressed state, hover underlines the label.
- 4AccordionContent
The revealed panel (text-sm text-foreground, pb-4 pt-0). Uses the fade-in animation when it opens or closes.
Variants
<Accordion type="single" collapsible>
<AccordionItem value="item-1">
<AccordionTrigger>Is it tokenized?</AccordionTrigger>
<AccordionContent>Yes. All Yuno tokens.</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Does it support multiple open?</AccordionTrigger>
<AccordionContent>Set type="multiple" instead of "single".</AccordionContent>
</AccordionItem>
</Accordion><Accordion type="multiple" defaultValue={["item-1", "item-2"]}>
<AccordionItem value="item-1">
<AccordionTrigger>Payment routing</AccordionTrigger>
<AccordionContent>Route payments by BIN, amount, and country.</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Fraud shield</AccordionTrigger>
<AccordionContent>Adds an extra 3D Secure step to risky payments.</AccordionContent>
</AccordionItem>
</Accordion>Recipes
Ready-to-copy compositions covering the most common Yuno usages of this atom.
type="single" collapsible. Only one answer visible at a time; the user can close the current one. The canonical marketing/help usage.
<Accordion type="single" collapsible className="w-full max-w-2xl">
<AccordionItem value="q-1">
<AccordionTrigger>How do refunds work?</AccordionTrigger>
<AccordionContent>
Refunds go through the same provider that captured the payment.
</AccordionContent>
</AccordionItem>
<AccordionItem value="q-2">
<AccordionTrigger>Can I test with sandbox cards?</AccordionTrigger>
<AccordionContent>
Yes. Every provider ships a set of sandbox cards documented in their guide.
</AccordionContent>
</AccordionItem>
<AccordionItem value="q-3">
<AccordionTrigger>Which currencies are supported?</AccordionTrigger>
<AccordionContent>
50+ currencies. Availability depends on the provider you route to.
</AccordionContent>
</AccordionItem>
</Accordion>type="multiple" so several groups can stay open while the user configures. Pass defaultValue with the group you want expanded on load.
<Accordion type="multiple" defaultValue={["notifications"]} className="w-full max-w-2xl">
<AccordionItem value="notifications">
<AccordionTrigger>Notifications</AccordionTrigger>
<AccordionContent>
Configure email, push and SMS delivery for account events.
</AccordionContent>
</AccordionItem>
<AccordionItem value="api-keys">
<AccordionTrigger>API keys</AccordionTrigger>
<AccordionContent>
Rotate and revoke keys used by your integrations.
</AccordionContent>
</AccordionItem>
<AccordionItem value="webhooks">
<AccordionTrigger>Webhooks</AccordionTrigger>
<AccordionContent>
Endpoints Yuno calls when a payment changes state.
</AccordionContent>
</AccordionItem>
</Accordion>AccordionContent accepts any JSX. Use a small definition grid (label / value rows) to preview a rule, transaction or resource without leaving the list.
<Accordion type="single" collapsible defaultValue="rule-1" className="w-full max-w-2xl">
<AccordionItem value="rule-1">
<AccordionTrigger>High-value BIN block</AccordionTrigger>
<AccordionContent>
<div className="grid gap-2 text-sm">
<div className="flex justify-between">
<span className="text-muted-foreground">Condition</span>
<span className="text-foreground">Amount > 500 USD</span>
</div>
<div className="flex justify-between">
<span className="text-muted-foreground">Action</span>
<span className="text-foreground">Block</span>
</div>
<div className="flex justify-between">
<span className="text-muted-foreground">Owner</span>
<span className="text-foreground">Risk team</span>
</div>
</div>
</AccordionContent>
</AccordionItem>
</Accordion>Import
Copy this import line at the top of the file where you compose this atom.
import {
Accordion,
AccordionItem,
AccordionTrigger,
AccordionContent,
} from "@/components/ui/accordion";Props
Everything else from the underlying HTML or Radix primitive is forwarded via ...props.
| Prop | Type | Default | Description |
|---|---|---|---|
| Accordion.type | "single" | "multiple" | — | "single" allows one open panel at a time; "multiple" allows several. Required. |
| Accordion.collapsible | boolean | false | Only for type="single". Lets the user close the currently open panel by clicking its trigger again. |
| Accordion.value / defaultValue | string | string[] | — | Controlled or uncontrolled open item(s). string for type="single", string[] for type="multiple". |
| Accordion.onValueChange | (value: string | string[]) => void | — | Fires when the open panel(s) change. Type mirrors the value prop. |
| Accordion.disabled | boolean | false | Disables every item in the group. |
| AccordionItem.value | string | — | Unique identifier for the item. Required. Used by value / defaultValue on the root. |
| AccordionItem.disabled | boolean | false | Disables this specific item (trigger becomes non-interactive). |
| AccordionTrigger.className | string | — | Merged via cn(). Base includes py-4, text-sm font-medium, focus ring 3px ring-ring/50 (rounded-md), active:opacity-60 pressed state, and rotates the CaretDown 180° on open. |
| AccordionContent.className | string | — | Merged with the inner wrapper (default pb-4 pt-0). The outer Radix content already handles overflow and the fade-in animation. |
When to use
- Long-form FAQs or grouped settings that don't all fit on screen.
- Collapsible groups of table columns or filters.
When not to use
- Structural navigation — use tabs or a sidebar.
- For a single toggle — use Collapsible directly.
Usage
- Keep triggers short and scannable.
- Give each section a clear heading.
- Don't nest accordions inside accordions.
- Don't animate too aggressively — subtle collapse works better.
Related
Cross-links to atoms and patterns you may reach for next.
- CollapsibleFor a single toggle, no grouping - Accordion is for 2+ sections.
- TabsFor switching between sibling views when only one should be visible at a time.
- SidebarFor persistent navigation - never use Accordion as the Dashboard's primary nav.
- DialogWhen the revealed content needs focus + Save/Cancel actions instead of inline expansion.