Neobrutalism UI LogoNeobrutal UI

Switch

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

Installation

npx neobrutal add switch

Usage

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

Props

PropTypeDefaultDescription
checkedboolean-The controlled checked state of the switch.
defaultCheckedboolean-The default checked state when uncontrolled.
onCheckedChange(checked: boolean) => void-Event handler called when the checked state changes.
disabledboolean-When true, prevents the user from interacting with the switch.