switch component

Drop-in semantic component. See examples, sizes, variants, and source.

Toggle switch for binary on/off settings. Compose a switch label around an input type="checkbox", a track, and a thumb. For labelled rows use switch labeled; for full settings rows use switch-card or switch-list. Programmatic helpers ship in switch.js.

Basic Switches

Default Switch States

Default
Checked
Disabled
Disabled Checked

Size Variants

Tiny
Small
Default
Large
Big

Color Variants

Primary
Positive
Negative
Warning
Info
Purple

Switches with Labels

Label Variations

Enable notifications
Dark mode
Marketing emails Receive emails about new products, features, and more.

Switch Cards

Card Styles

Wi-Fi
Connect to wireless networks
Push Notifications
Get notified about important updates
Advanced Security
Premium feature - Upgrade to enable

List Style

Airplane Mode
Disable all wireless connections
Bluetooth
Connect to nearby devices
Location Services
Allow apps to use your location
Do Not Disturb
Silence calls and notifications

Integration Switches

Grouped Switches

Notification Channels

Email
SMS
Push

Privacy Settings

Profile Visibility
Make your profile public
Show Online Status
Let others see when you're active

Interactive Examples

Programmatic Control

Event Handling

Status: OFF

Class API Reference

Type Class Usage Notes
Base switch The label that wraps the checkbox + track + thumb Always required
track The pill-shaped background Sibling of the input
thumb The sliding circle Child of track
Sizes xs Tiny — 32×16px track Modifier on switch
sm Small — 40×20px track Modifier on switch
(default) Medium — 44×24px track No size class needed
xl Large — 56×28px track Modifier on switch
lg Big — 64×32px track Modifier on switch
Intents primary Blue when checked Modifier on switch
positive Green when checked Modifier on switch
negative Red when checked Modifier on switch
warning Yellow when checked Modifier on switch
info Blue (sky) when checked Modifier on switch
Extended Palette red / orange / yellow / olive / green / teal / blue / violet / purple / pink / brown / grey / black Direct palette colors Use intents (primary/positive/...) when possible
States disabled Greyed out, not interactive Or use the disabled attribute on the input
Layout labeled Switch with text label beside it Add a label sibling
flip Reverses label/switch order Combine with labeled
with-description Two-line label + description block Combine with labeled
Wrapper switch-card Settings-row card with text + switch Holds content and a switch
switch-list Settings-list row (no card chrome) Use inside a bordered container
switches Container — children inherit color/size Combine with primary/positive/etc.
integration-switch Group of switches with shared header Add horizontal for inline rows