Skip to content

Switch

Base UI

A square switch with a real switch role.

Install

$ npx shadcn@latest add https://spotcheckui.com/r/switch.json

Also installs @base-ui/react.

Usage

import { Switch } from "@/components/spotcheck/switch"

<Switch checked={stream} onCheckedChange={setStream}>Stream responses</Switch>

Props

  • childrenReactNodeDefault —The visible label.
  • classNamestringDefault —

Keyboard

SpaceTurn on or off

Reduced motion

The knob moves at once.