@usevyre/react@usevyre/vue

Switch

A toggle control rendered as role="switch" with full keyboard support. Works controlled or uncontrolled.


States & sizes

Notifications disabled
Small size (uncontrolled)
Disabled
import { Switch } from "@usevyre/react";

// Uncontrolled
<Switch defaultChecked />

// Controlled
const [on, setOn] = useState(false);
<Switch checked={on} onCheckedChange={setOn} />

Props

Props

PropTypeDefaultDescription
checkedbooleanControlled on/off state.
defaultCheckedbooleanfalseInitial state (uncontrolled).
disabledbooleanfalseDisables the switch.
size"sm" | "md""md"Switch size.
onCheckedChange(v: boolean) => voidReact only. Called when the state changes.
classstringAdditional CSS class.