# Press Button

> A button with real travel, like a mechanical key.

It stands on its own edge and sinks when pressed. Works as a toggle with `pressed`. CSS transitions, so it reacts on the first frame.

- Family: Buttons
- Plan: Free. Free to install, no account.
- Requires: React, Tailwind CSS v4 and the motion package
- Page with a live preview: https://galactrex.com/ui/press-button/
- Licence: https://galactrex.com/ui/license/

## Install

```sh
npx @galactrex/ui add press-button
```

It installs to `components/galactrex/press-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 { PressButton } from "@/components/galactrex/press-button";

<PressButton pressed={muted} onClick={() => setMuted((m) => !m)}>Mute</PressButton>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | — | Label. |
| `depth` | `number` | `5` | Key height in px. |
| `pressed` | `boolean` | — | Stays down, as a toggle (aria-pressed). |
| `...button props` | `ButtonHTMLAttributes` | — | onClick, disabled, type and the rest. |

## Variants

- **Key.** A single satisfying action.
- **Toggle.** Bold, italic, mute: `pressed` keeps it down.

## Accessibility

- aria-pressed when used as a toggle.

## Motion

- A 75 ms transform on press.
- Reduced motion: no transition, still moves.
