Switch is used to toggle between two states on and off. It is commonly used in settings panel, forms and any other place where a user needs to enable or disable feature.
"use client"; import Switch from "@radui/ui/Switch"; export default function SwitchExample() { return <Switch.Root> <Switch.Thumb /> </Switch.Root>; }
Root component for the Switch component.
Prop | Type | Default |
---|---|---|
children | React.ReactNode | null |
customRootClass | string | '' |
Thumb component for the Switch component.
Prop | Type | Default |
---|---|---|
asChild | boolean | false |
customThumbClass | string | '' |