Black Friday: 30% off Pro

Get 30% off

Updated

Tactile Toggle

Preview

Customize

Accent
Squish6px

Installation

npx shadcn@latest add https://uibrik.com/r/tactile-toggle.json
Adds the files to components/uibrik/tactile-toggle and installs motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/tactile-toggle.

Usage

import { TactileToggle } from "@/components/uibrik/tactile-toggle/tactile-toggle";​<TactileToggle  accent="#22c55e"  squish={6}  disabled={false}  defaultChecked={false}  onCheckedChange={(checked) => {}}  // checked={false}  // aria-label="…"/>

Where to use Tactile Toggle

  • On/off settings

    A knob that squishes and drags like a real switch makes a single setting satisfying.

    Pairs with Tactile Toggles

  • Feature toggles

    A clear physical state suits dark mode and beta feature switches.

    Pairs with Theme Switch

  • Smart-home controls

    Springing home on release mirrors real hardware switches.

Props

TactileToggle
accent
Type string
"#22c55e"
Track colour when on.
squish
Type number
6
How far the knob stretches while pressed.
disabled
Type boolean
false
Stops the switch responding.
checked
Type boolean
–
Controlled state. Leave out to let the toggle keep its own.
defaultChecked
Type boolean
false
Starting state when uncontrolled.
onCheckedChange
Type (checked: boolean) => void
–
Called with the new state when the switch flips.
aria-label
Type string
Toggle
Accessible name, since the switch shows no text.
className
Type string
–
Classes for the switch.