# Accordion

Sections people can open and close.

- **Use it for**: Collapsible sections, including a single one people can expand.
- **Not for**: Content people need to compare side by side. Try [Tabs](https://unseenui.com/components/tabs/).

## Installation

```bash
npm install @stackunseen/ui
```

## Usage

```tsx
import { Accordion } from '@stackunseen/ui';
import '@stackunseen/ui/styles.css';

<Accordion variant="divided" type="multiple" items={sections} />
```

## Props

- `type` (`'single' | 'multiple'`): Allow one or several panels to be open.
- `items` (`AccordionItem[]`): Stable value, title and content for each panel. Optional disabled and keepMounted flags. Titles must not contain buttons or links.
- `value` (`string | string[] (optional)`): Controlled open panel values; update them through onValueChange. Use defaultValue for local disclosure state.
- `headingLevel` (`2 | 3 | 4 | 5 | 6 (optional)`): Match the surrounding heading outline. Defaults to 3.
- `region` (`boolean (optional)`): Use false for nested or repeated supporting panels to avoid excess region landmarks.

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `headingLevel` | `3 \| 2 \| 4 \| 5 \| 6` |  |
| `items` (required) | `readonly AccordionItem[]` |  |
| `region` | `boolean` | Use a labelled group for nested/repeated disclosures to avoid excess landmarks. |
| `variant` | `"divided" \| "bordered" \| "separated"` |  |

## Keyboard

Enter or Space toggles the focused panel. Arrow keys, Home and End move between enabled headings. Closed controls are hidden from keyboard navigation.

## Works with

[Card](https://unseenui.com/components/card/), [Table](https://unseenui.com/components/table/), [Tag](https://unseenui.com/components/tag/), [DiffStat](https://unseenui.com/components/diff-stat/), [ElapsedTime](https://unseenui.com/components/elapsed-time/), [Numeric](https://unseenui.com/components/numeric/), [Kbd](https://unseenui.com/components/kbd/), [DotRing](https://unseenui.com/components/dot-ring/), [DotBars](https://unseenui.com/components/dot-bars/), [WeekStrip](https://unseenui.com/components/week-strip/), [HeatKeys](https://unseenui.com/components/heat-keys/), [Sparkline](https://unseenui.com/components/sparkline/)

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