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.

import Switch from "@radui/ui/Switch"
Preview
React
"use client"; import Switch from "@radui/ui/Switch"; export default function SwitchExample() { return <Switch.Root aria-label="Airplane mode"> <Switch.Thumb /> </Switch.Root>; }

Root component for the Switch component.

PropTypeDefault
children
React.ReactNodenull
customRootClass
string''
color
string''
variant
string—
size
string—
defaultChecked
booleanfalse
checked
boolean—
onCheckedChange
function—
disabled
booleanfalse
required
booleanfalse
name
string—
value
string—
asChild
booleanfalse
readOnly
booleanfalse
uncheckedValue
string—
form
string—
inputRef
Ref<HTMLInputElement>—

Thumb component for the Switch component.

PropTypeDefault
asChild
booleanfalse
className
string—
children
ReactNode—
ShortcutDescription
Tab

Moves focus to the switch.

Space

Toggles the checked state.

Enter

Toggles the checked state.

ReferenceWhat Rad UI follows
Switch pattern

Uses switch semantics with aria-checked to expose the current on or off state.