---
title: "Accordion"
description: "A stack of headings that each open a panel of text under them. Use it for an FAQ or for settings groups. It has four looks."
url: https://gelatinui.com/components/accordion
markdown_url: https://gelatinui.com/components/accordion.md
access: free
install: "npx shadcn@latest add @gelatin-ui/accordion"
registry_item: https://gelatinui.com/r/accordion.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Accordion

> A stack of headings that each open a panel of text under them. Use it for an FAQ or for settings groups. It has four looks.

Page: https://gelatinui.com/components/accordion

## When to use it

Best for: An FAQ or a list of settings groups, where each heading opens its own panel.

- Use it for an FAQ or for settings groups.
- Set `multiple` to keep many panels open.
- Pass `defaultValue` with an array of open items, even for one panel.

## When not to use it

- For one panel with one trigger, use a [Collapsible](https://gelatinui.com/components/collapsible.md).
- For views of one thing in one place, use [Tabs](https://gelatinui.com/components/tabs.md).

## Notes for agents

- The value is an array in both modes.
- Give each `AccordionItem` a `value`.
- Cancel a change with `eventDetails.cancel()` in `onValueChange`.
- `hiddenUntilFound` lets the find in page of the browser open a panel.

## Anatomy

```text
Accordion
├─ AccordionItem (0..n)
├─ AccordionTrigger (0..n)
└─ AccordionContent (0..n)
```

## API reference

### Accordion

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | `"contained" \| "default" \| "filled" \| "separated"` | "default" |  |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Accordion.Root`: https://base-ui.com/react/components/accordion

### AccordionItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Collapsible.Root`: https://base-ui.com/react/components/collapsible

### AccordionTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `headerProps` | `Omit` |  | Props of the heading around the button (Base UI `Accordion.Header`, an `<h3>`). Set the level that fits the page with a render function: `headerProps={{ render: ({ children...props }) => <h2 {...props}>{children}</h2> }}`. The element form `render: <h2 />` works too, but `jsx-a11y/heading-has-content` reports it, because the rule cannot see that Base UI adds the children. A `className` here adds to the component classes. |

### AccordionContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Accordion.Root`: https://base-ui.com/react/components/accordion

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Accordion | `accordion` | `data-disabled`, `data-open`, `data-stage-active`, `data-stage-hover` |  | `motion-timing` |
| AccordionItem | `accordion-item` | `data-disabled`, `data-open`, `data-stage-active`, `data-stage-hover` |  | `motion-timing` |
| AccordionTrigger | `accordion-trigger` | `data-disabled`, `data-open`, `data-stage-active`, `data-stage-hover` |  | `motion-timing` |
| AccordionContent | `accordion-content` | `data-disabled`, `data-open`, `data-stage-active`, `data-stage-hover` |  | `motion-timing` |

## Usage

Compose one item for each panel.

```tsx title="pricing-faq.tsx"
import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger,
} from "@/components/ui/accordion";

export function PricingFaq() {
  return (
    <Accordion defaultValue={["cost"]}>
      <AccordionItem value="cost">
        <AccordionTrigger>What does it cost?</AccordionTrigger>
        <AccordionContent>Teams of three use it for free.</AccordionContent>
      </AccordionItem>
    </Accordion>
  );
}
```

## Compose

Rules:

- Group with a Frame (`group-in-frames`): Put related panels in one `Frame` with its header and footer outside the panels, and keep a plain `Card` for one block of content.
- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/accordion
```

It adds 13 registry items: 12 files, 2629 lines, and the npm packages `@base-ui/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Collapsible](https://gelatinui.com/components/collapsible.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Collapsible](https://gelatinui.com/components/collapsible.md): Pick Collapsible for one panel with one trigger, not a stack of headings.
- [Tabs](https://gelatinui.com/components/tabs.md)
- [Spoiler](https://gelatinui.com/components/spoiler.md): Pick Spoiler for one block of long content cut at a height, with a Show more button under a fade.

## Keyboard

| Keys | Action |
| --- | --- |
| Enter, Space | Opens or closes the panel of the focused heading. |
| ↑ ↓ | Moves between the headings. |
| Home, End | Moves to the first or the last heading. |

## Accessibility

Each trigger is a real button in a heading, with its expanded state.

A row is 44px tall, so it is a full touch target.

## Motion

| Part | Motion |
| --- | --- |
| Panel | panel · the height opens and closes |
| Row | hover · the fill of the `filled` variant |
