# <expansion-panel>

A panel that opens and closes on a tap of its header, as HTML's details and summary.

Category: Forms and input. Also written `<accordion>`, `<details>`.

```ham
<column style="w-full">
    <expansion-panel title="Shipping"
                     icon="local_shipping"
                     expanded="true">
        <text>Free over $50. Orders ship within two working days.</text>
    </expansion-panel>
    <details>
        <summary>Returns</summary>
        <text>Return anything unworn within 30 days.</text>
    </details>
</column>
```

How Hype Apps draws it on a phone: [light](https://hypeapps.dev/img/tags/expansion-panel-light.webp), [dark](https://hypeapps.dev/img/tags/expansion-panel-dark.webp).

## Attributes

| Name | What it does | Default |
|---|---|---|
| `expanded` | Initially expanded | `false` |
| `icon` | Leading icon |  |
| `open` | HTML form of expanded (for <details>); bare attribute works | `false` |
| `subtitle` | Subtitle text |  |
| `title` | Header title; none without it (or a <summary>) |  |
| `variant` | plain: no Material tile. The <summary> is the header as written (your own row and chevron), a tap opens and closes the rest, nothing is padded or indented; \$id.open says which, and #id.open / #id.close / #id.toggle work. (plain) |  |

## Commands

| Name | What it does |
|---|---|
| `close` | variant="plain": close it. |
| `open` | variant="plain": open it. |
| `toggle` | variant="plain": open or close it. |

## Readings

| Name | What it does |
|---|---|
| `expanded` | The same, named after expanded=. |
| `open` | Whether the panel is open. |

Any tag also takes gestures: `@on.tap`, `@on.longpress`, `@on.doubletap` and `@on.swipeleft` (and right, up and down). `@click` runs on a tap too.

## Related tags

- [`<column>`](https://hypeapps.dev/docs/reference/column.md): Stacks its children top to bottom, with a gap between them and an alignment across.
- [`<text>`](https://hypeapps.dev/docs/reference/text.md): A run of text; with @text it shows an expression that updates as its variables change.
- [`<summary>`](https://hypeapps.dev/docs/reference/summary.md): The header of a <details> panel: its text is the title you tap to open or close it.
- [`<button>`](https://hypeapps.dev/docs/reference/button.md): A tappable button that runs an action: a fetch, a navigation or a statement.
- [`<checkbox>`](https://hypeapps.dev/docs/reference/checkbox.md): A checkbox with a label; its state goes into a variable by name.
- [`<chip>`](https://hypeapps.dev/docs/reference/chip.md): A compact chip: a label, a filter that toggles, a single choice in a set, or an action.
- [`<color-picker>`](https://hypeapps.dev/docs/reference/color-picker.md): A color picker: a hue ring round a disc, with swatches; the chosen color goes into a variable.
- [`<data-cell>`](https://hypeapps.dev/docs/reference/data-cell.md): One cell of a data table row.

All tags: https://hypeapps.dev/docs/reference.md · The full reference: https://hypeapps.dev/llms.txt
