Command Palette

Search for a command to run...

Switch

shadcn/ui

A control that allows the user to toggle between checked and not checked.

Switch

import { Switch } from "@/components/optics/switch";import { Label } from "@/components/optics/label";<div className="flex items-center space-x-2">  <Switch id="airplane-mode" />  <Label htmlFor="airplane-mode">    Airplane Mode  </Label></div>

Installation

pnpm dlx shadcn@latest add @optics/switch

Props

<Switch />
Name
Type
render
React.ReactElement
nativeButton
boolean
onCheckedChange
(...args) => void
inputRef
React.Ref<HTMLInputElement>
uncheckedValue
string