Switch
Switch components provide a way to toggle between two states, typically representing on/off or enabled/disabled states.
Examples
(7)Properties
(39)Playground
Basic Usage
Control a
Switch with local state and surface its status with supporting text and the description prop.Sizes
Choose a
size token to scale the switch track and thumb; defaultChecked seeds uncontrolled switches.Variants
Choose between a solid
filled track (default) and an outline track whose border and thumb take on the active color.Label on the thumb
Render content inside the moving thumb with the
onIcon / offIcon props — an icon or a short text label that swaps with the on/off state.Colors
Provide a
color token to align switches with semantic palettes such as primary, success, or error states.States
Present interactive, disabled, and validation states by combining
checked, disabled, required, and error props.Shared State
Coordinate multiple switches with a shared state object and reflect the current selections in supporting copy.
Scan to open this page on your phonereact-ui-library.com/components/Switch
</>
react-ui-library
100+ accessible, themeable components that work seamlessly across iOS, Android, and Web.
A Platform Blocks product.
Quick Links
Resources