Switch

PreviousNext

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

import { Label } from "@/components/ui/label"
import { Switch } from "@/components/ui/switch"

export function SwitchDemo() {
  return (
    <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 "https://ui.jiaweing.com/r/styles/new-york-v4/switch.json"

Usage

import { Switch } from "@/components/ui/switch"
<Switch />
Documentation›Components›Switch