Switches toggle the state of a single setting on or off.
size
color
isDisabled
1<v />1<Switch />npm install @rootui/switch1import { Switch } from "@rootui/switch";
2
3export default function Page() {
4 return (
5 <Switch />
6 )
7}See the React Aria documentation for more information.
Prop | Type | Default |
|---|---|---|
| | |
Whether the Switch should be selected (uncontrolled). | ||
| | |
Whether the Switch should be selected (controlled). | ||
| | |
Whether the input is disabled. | ||
| | |
Whether the input can be selected but not changed by the user. | ||
| | |
Handler that is called when the Switch's selection state changes. | ||
Attribute | Description |
|---|---|
| Whether the switch is selected. |
| Whether the switch is currently hovered with a mouse. |
| Whether the switch is currently in a pressed state. |
| Whether the switch is focused, either via a mouse or keyboard. |
| Whether the switch is keyboard focused. |
| Whether the switch is disabled. |
| Whether the switch is read only. |