https://framer.com/m/Switch-9QNmVi.js#Switch

Io / UI Basics / Switch

Switch

Switch is an on/off toggle that applies immediately — no submit step in between. Track radius, thumb size, margin and shadow are props; the colours are left empty so the theme supplies them.

Interactiveon · offtrack and thumblabel on either side

Examples

Live specimens for every control the component exposes.

Default

A track, a thumb and a label. The change applies the moment it is made.

State

checked and disabled are independent, so all four combinations are reachable.

checked false

checked true

disabled

on and disabled

Track and thumb

trackR and thumbR take the control from a pill to a square; thumbMargin sets how far the thumb sits inside the track.

default radii

trackR 4 · thumbR 3

thumbMargin 5

Shadow

shadow lifts the thumb off the track. Turn it off for a flatter control.

shadow true

shadow false

Label

side flips the label across the track, gap sets the distance, and fontSize picks a theme type step.

side right · gap 10

side left · gap 10

fontSize Detail · gap 16

Props

The controls exposed on the instance panel.

PropTypeBehaviour
checkedbooleanWhether the switch starts on.
disabledbooleanBlocks interaction and dims the control.
activeBGcolorTrack fill when on.
inactiveBGcolorTrack fill when off.
trackRnumberCorner radius of the track.
borderbooleanDraws an outline around the track.
widthnumberOutline width when border is on.
activecolorOutline colour when on.
inactivecolorOutline colour when off.
thumbBGcolorThumb fill.
thumbMarginnumberInset of the thumb inside the track.
focusRingcolorFocus ring for keyboard users.
thumbRnumberCorner radius of the thumb.
shadowbooleanDrops a shadow under the thumb.
labelbooleanWhether the label is shown at all.
textstringThe label text itself.
sideenumleft or right — which side of the track the label sits on.
gapnumberSpace between track and label.
fontSizeenumTheme type step for the label.
weightenumlight · regular · medium · semibold · bold.
colorcolorLabel colour.
sizingenumfill stretches the control to its container; fit hugs the content.
truncatenumberLine count before the label is clipped; 0 never clips.
namestringField name used on form submission.
valuestringValue submitted when on.
requiredbooleanMarks the field as required in a form.
transitiontransitionAnimation used between states.
onToggleeventFires on every state change.
onCheckeventFires when it turns on.
onUncheckeventFires when it turns off.
PropTypeBehaviour
checkedbooleanWhether the switch starts on.
disabledbooleanBlocks interaction and dims the control.
activeBGcolorTrack fill when on.
inactiveBGcolorTrack fill when off.
trackRnumberCorner radius of the track.
borderbooleanDraws an outline around the track.
widthnumberOutline width when border is on.
activecolorOutline colour when on.
inactivecolorOutline colour when off.
thumbBGcolorThumb fill.
thumbMarginnumberInset of the thumb inside the track.
focusRingcolorFocus ring for keyboard users.
thumbRnumberCorner radius of the thumb.
shadowbooleanDrops a shadow under the thumb.
labelbooleanWhether the label is shown at all.
textstringThe label text itself.
sideenumleft or right — which side of the track the label sits on.
gapnumberSpace between track and label.
fontSizeenumTheme type step for the label.
weightenumlight · regular · medium · semibold · bold.
colorcolorLabel colour.
sizingenumfill stretches the control to its container; fit hugs the content.
truncatenumberLine count before the label is clipped; 0 never clips.
namestringField name used on form submission.
valuestringValue submitted when on.
requiredbooleanMarks the field as required in a form.
transitiontransitionAnimation used between states.
onToggleeventFires on every state change.
onCheckeventFires when it turns on.
onUncheckeventFires when it turns off.

Usage

Guidance carried over from the component definition.

Reach for Switch

The change takes effect immediately, with no save step.

The choice is genuinely binary — on or off.

It reads as a setting rather than a form field.

You want the hover, focus and disabled states handled for you.

Reach for something else

The choice needs confirming before it applies — use Checkbox in a form.

There are more than two states.

It is one option among several — use RadioGroup.

Io — UI Basics

Every switch above is a live Switch instance. Colour, type and radius resolve from the project theme tokens — the colour props are deliberately left empty.

io

An experiment in what a design system becomes when AI can consume it.

© 2026 io

Contact me

Create a free website with Framer, the website builder loved by startups, designers and agencies.