# Expand Button

> An icon that grows its label when you reach for it.

Keeps a toolbar compact without leaving anyone guessing: the label slides out on hover or focus.

- Family: Buttons
- Plan: Creative. Included with Creative.
- Requires: React, Tailwind CSS v4 and the motion package
- Page with a live preview: https://galactrex.com/ui/expand-button/
- Licence: https://galactrex.com/ui/license/

## Install

```sh
npx @galactrex/ui login   # once, with an API key from https://galactrex.com/account/
npx @galactrex/ui add expand-button
```

It installs to `components/galactrex/expand-button.tsx`, with the shared motion helpers beside it. First time in a project: `npx @galactrex/ui init` (setup guide: https://galactrex.com/docs/ui-components-setup/).

## Usage

```tsx
import { ExpandButton } from "@/components/galactrex/expand-button";

<ExpandButton icon={<PlusIcon />} label="New project" />
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `icon` | `ReactNode` | — | Icon at rest. |
| `label` | `string` | — | The words that slide out; also its name. |
| `tone` | `"solid" \| "outline" \| "ghost"` | `"outline"` | Look. |
| `expanded` | `boolean` | — | Keep it open. |
| `...button props` | `ButtonHTMLAttributes` | — | onClick, disabled, type and the rest. |

## Variants

- **Toolbar.** A row of icon actions.

## Accessibility

- The label is always its accessible name.

## Motion

- Layout animation on a spring.
- Reduced motion: the label appears without travel.
