# Expand Button

> An icon-only button that springs open to reveal its label on hover or keyboard focus.

## Spec sheet

| | |
| --- | --- |
| Access | Free: no account, free for commercial use |
| Shelf | Components › Buttons |
| Live preview | https://uibrik.com/components/expand-button |
| Writes | 1 file into `components/uibrik/expand-button/` |
| Packages | `motion`, `react-use-measure` (the CLI installs them) |
| Needs | React 19, Tailwind CSS v4, a project set up with `npx shadcn@latest init` |
| Theme | Reads the shadcn tokens and follows class-based dark mode ([theming](https://uibrik.com/docs/theming.md)) |
| Updated | Nov 9, 2026 |

## Add it

```bash
npx shadcn@latest add https://uibrik.com/r/expand-button.json
```

With the `@uibrik` namespace in `components.json` ([setup](https://uibrik.com/docs/installation.md)): `npx shadcn@latest add @uibrik/expand-button`.

Can't run commands? https://uibrik.com/components/expand-button/prompt.txt has every file verbatim, with the setup steps, ready for an assistant to write.

## Render it

Renders as is; every value shown is the default, so delete any line you don't need.

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

<ExpandButton
  icon={<IconPlus size={20} />}
  label="New file"
  reveal="blur"
  variant="soft"
  size={40}
  radius={12}
  expanded={false}
  onClick={(event) => {}}
/>
```

## Tune it

The same props as the Customize panel on https://uibrik.com/components/expand-button.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `reveal` | `"blur" \| "slide" \| "fade"` | `"blur"` | How the label appears as the button opens. |
| `variant` | `"soft" \| "ghost" \| "outline"` | `"soft"` | Tinted, transparent until open, or outlined. |
| `size` | `number` | `40` | Height, and resting width. |
| `radius` | `number` | `12` | Corner radius. |

## Wire it

The props the Customize panel doesn't show: ranges, data, content and callbacks.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `icon` (required) | `ReactNode` |  | Shown at rest. |
| `label` (required) | `string` |  | Revealed on hover or keyboard focus. Also the accessible name. |
| `expanded` | `boolean` | `false` | Keep the label showing, e.g. for the active item. |
| `onClick` | `MouseEventHandler<HTMLButtonElement>` |  | Called on click, like any button. |
| `className` | `string` |  | Classes for the button. |

## Where it fits

- **Compact toolbars**: Icon buttons reveal their label on hover or focus, so toolbars stay small but clear. Pairs with [Fold Toolbar](https://uibrik.com/components/fold-toolbar.md).
- **Floating actions**: A label that springs open explains what a floating button does before it is pressed.
- **Mobile headers**: Icon-only buttons save space while focus still shows the label for accessibility.

## Same shelf: Buttons

- [Hold to Confirm](https://uibrik.com/components/hold-to-confirm.md): A destructive-action button that has to be held down; a fill grows across it and drains back if released early.
- [Inline Confirm](https://uibrik.com/components/inline-confirm.md): A destructive button that splits into Cancel and Confirm in its own footprint, so nothing around it moves.
- [Mesh Button](https://uibrik.com/components/mesh-button.md) (Pro): A button painted with a softly blended mesh gradient under rolling silk waves that catch a satin sheen; the pointer presses into the silk and a click ripples it.
- [Prism Button](https://uibrik.com/components/prism-button.md) (Pro): A graphite button with a border of polished metal that splits light like a prism; the glint travels round the border and turns to follow the pointer.
- [Share Menu](https://uibrik.com/components/share-menu.md): A share button that flips open into a pill of options, resizing to fit.
- [Soft Button](https://uibrik.com/components/soft-button.md): A plain button made with care: a gentle top-to-bottom gradient, a faint inner highlight and shade, and a crisp border, in primary, secondary and accent.

## Ground rules

- Only the props above exist. To change anything else, edit the installed file.
- Keep the files in `components/uibrik/expand-button/` so the import paths keep resolving.
- The playbook for working with the whole library: https://uibrik.com/llms.txt
