2.0 alpha
These docs describe 2.0. Install it with @once-ui-system/core@alpha.
On 1.8.x? Read the 1.x docs
TrademarkTrademarkDocs
Ctrl k
Search docs...
Form Controls

Switch

Updated: May 12, 2025
View on GitHub
The Switch component provides a toggle control for binary states, featuring a sliding animation when toggled. It's commonly used for enabling or disabling features and settings. Control the switch state with the checked prop. Show a loading spinner while an action is being processed. Disable the switch to prevent user interaction. Place the switch on the right side of the label.
Prop
Type
Default
style
React.CSSProperties
className
string
checkedrequired
Whether it is on. Controlled — there is no uncontrolled mode.
boolean
loading
Show a spinner in the track while something resolves.
booleanfalse
name
Form field name.
string
value
Form field value.
string
disabled
Block interaction.
boolean
reverse
Put the label before the switch instead of after it.
booleanfalse
ariaLabel
Label for a switch with no visible one.
stringToggle switch
onTogglerequired
Called when it is flipped, by pointer or keyboard.
() => void
label
ReactNode
description
ReactNode
iconButtonProps
Props forwarded to the icon button beside the label.
IconButtonProps
…and every React.InputHTMLAttributes propinherited
Edit this page on GitHub
TrademarkTrademark
Built with curiosity by Lorant One and the Design Engineers Club