Skip to main content

Switch

Toggle between 2 states, built on Base UI.

View as Markdown

Installation

Component API

PropTypeDefaultDescription
labelstring-Text beside the track.
Text beside the track.
descriptionstring-A line under the label, for the consequence of turning it on.
A line under the label, for the consequence of turning it on.
defaultCheckedbooleanfalse
checkedboolean-Controlled state.
Controlled state.
onCheckedChange(checked: boolean) => void-
iconReactNode-
ariaLabelstring-The accessible name, for a switch with no visible label.
The accessible name, for a switch with no visible label.
sizesm | md | lgmdTrack and thumb together.
Track and thumb together.
shapenone | rounded | pillrounded
disabledbooleanfalseBlocks interaction and dims the whole control, label included.
Blocks interaction and dims the whole control, label included.
animatedbooleantrue
classNamestring-
focusboolean | stringtrue