Switch

Switch is a neobrutalist React component from Cruise UI. An on/off toggle for settings that take effect straight away. Install it with npx shadcn@latest add @cruiseui/switch.

Install

Terminal

npx shadcn@latest add @cruiseui/switch

First time? Installation shows the one-off components.json setup (the @cruiseui registry) and how to turn the theme on.

Example

Corners

When to use it

When to use

Settings that apply immediately: notifications, dark mode.

When not to

Inside a form that is submitted later (use a Checkbox).

Props

CruiseSwitch

PropTypeDefaultDescription
labelReactNode——
checked?boolean——
defaultChecked?booleanfalse—
onCheckedChange?((checked: boolean) => void)——
showState?booleanfalseShow "On" / "Off" after the label (state not by colour alone).
disabled?boolean——
className?string——

Accessibility

  • <button role="switch"> with aria-checked; Space and Enter toggle it.
  • The knob position changes too, so the state never relies on colour alone.