# Accordion

> Vertically stacked sections that expand one at a time.

- Category: [Navigation](https://tarve.dev/docs.md#navigation)
- Import: `import { Accordion } from "@tarve/core";`
- Props type: `AccordionProps`
- Source: [packages/core/src/controls.ts:209](https://github.com/omarcosr/tarve/blob/main/packages/core/src/controls.ts#L209)

## Usage

```tsx title="Accordion.tsx"
import { Accordion, Text } from "@tarve/core";

let open: string | undefined = "renderers";

<Accordion
  value={open}
  items={[
    { value: "renderers", title: "Which renderers are there?", content: <Text>D3D11, Vello/WGPU and a CPU path.</Text> },
    { value: "platforms", title: "Which platforms?", content: <Text>Windows x64, Linux x64 and Android.</Text> },
  ]}
  onValueChange={(value) => {
    open = value;
  }}
/>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `items` (required) | `AccordionItem[]` | — |  |
| `onValueChange` | `(value: string \| undefined) => void` | — |  |
| `value` | `string` | — |  |

## Common props

Shared by every component (descriptions: https://tarve.dev/docs.md#common-props): `children`, `class`, `className`, `highlight`, `id`, `key`, `motionFrom`, `onHighlight`, `onPaste`, `onPointerLeave`, `onPointerMove`, `onSize`, `onTransitionEnd`, `rovingGroup`, `style`.

## Types

```ts title="AccordionItem"
interface AccordionItem { value: string; title: string; content: Child; disabled?: boolean }
```

Previous: [Tabs](https://tarve.dev/docs/components/Tabs.md) · Next: [Collapsible](https://tarve.dev/docs/components/Collapsible.md)

---

Tarve v0.13.8 · HTML version: https://tarve.dev/docs/components/Accordion · Index for agents: https://tarve.dev/llms.txt
