# Tactile Toggle

> A single switch whose knob squishes under the finger, drags like the real thing and springs home on release.

## Spec sheet

| | |
| --- | --- |
| Access | Free: no account, free for commercial use |
| Shelf | Components › Buttons |
| Live preview | https://uibrik.com/components/tactile-toggle |
| Writes | 1 file into `components/uibrik/tactile-toggle/` |
| Packages | `motion` (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/tactile-toggle.json
```

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

Can't run commands? https://uibrik.com/components/tactile-toggle/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 { TactileToggle } from "@/components/uibrik/tactile-toggle/tactile-toggle";

<TactileToggle
  accent="#22c55e"
  squish={6}
  disabled={false}
  defaultChecked={false}
  onCheckedChange={(checked) => {}}
  // checked={false}
  // aria-label="…"
/>
```

## Tune it

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

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `accent` | `string` | `"#22c55e"` | Track colour when on. |
| `squish` | `number` | `6` | How far the knob stretches while pressed. |
| `disabled` | `boolean` | `false` | Stops the switch responding. |

## Wire it

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

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `checked` | `boolean` |  | Controlled state. Leave out to let the toggle keep its own. |
| `defaultChecked` | `boolean` | `false` | Starting state when uncontrolled. |
| `onCheckedChange` | `(checked: boolean) => void` |  | Called with the new state when the switch flips. |
| `aria-label` | `string` | `Toggle` | Accessible name, since the switch shows no text. |
| `className` | `string` |  | Classes for the switch. |

## Where it fits

- **On/off settings**: A knob that squishes and drags like a real switch makes a single setting satisfying. Pairs with [Tactile Toggles](https://uibrik.com/components/tactile-toggles.md).
- **Feature toggles**: A clear physical state suits dark mode and beta feature switches. Pairs with [Theme Switch](https://uibrik.com/components/theme-switch.md).
- **Smart-home controls**: Springing home on release mirrors real hardware switches.

## Same shelf: Buttons

- [Theme Switch](https://uibrik.com/components/theme-switch.md): Switches the page theme: the sun pulls in its rays and is eclipsed into a moon while the new theme spreads out from the button.
- [Announcement Pill](https://uibrik.com/components/announcement-pill.md): A small New pill for above a hero heading, with a band of light along its border and an arrow that grows on hover.
- [Balloon Button](https://uibrik.com/components/balloon-button.md): An inflated, half-balloon button drawn with a WebGL shader, with folds along its seam and a springy dent when pressed.
- [Bookmark Button](https://uibrik.com/components/bookmark-button.md): A save button whose bookmark fills from the top like a dropped ribbon while the label rolls to Saved.
- [Chain Copy](https://uibrik.com/components/chain-copy.md): A copy-link button whose chain icon snaps apart when pressed, flings two chips from the break, then swings back together and relinks as the label rolls to Copied.
- [Consequence Button](https://uibrik.com/components/consequence-button.md): A button that widens on hover or focus to show what a click will do, like Deploy · main → Production, so you read the outcome before you commit. On touch the first tap shows it.

## Ground rules

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