Switch

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

Saved preference for elorm init --ui-library base-ui
PreviewCode
"use client"

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

export function SwitchDemo() {
  return (
    <div className="flex items-center gap-2">
      <Switch id="demo-switch" defaultChecked />
      <Label htmlFor="demo-switch">Airplane mode</Label>
    </div>
  )
}

Installation#

Usage#

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

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