switch
a square track and a square thumb. on fills the track with foreground and moves the thumb to the end.
bunx --bun shadcn@latest add @mk/switchexample
turn completion notices on or off. the words belong to the label, so clicking them changes the switch too.
completion notices are on
completion notices are on
sizes
the default track is 32 by 18 px; small is 24 by 14 px. both keep a larger pointer target around the track.
sm
24 × 14 px
default
32 × 18 px
sm
24 × 14 px
default
32 × 18 px
states
off keeps the input edge. on is solid, hover changes the fill, and keyboard focus draws the house ring outside the track. disabled keeps the thumb in its current position.
off
input edge and square
hover, off
control hover fill
on
solid foreground
hover, on
foreground hover
focus
2 px ring, 2 px out
invalid
error edge
disabled, off
faint stock, dim square
disabled, on
square stays at the end
off
input edge and square
hover, off
control hover fill
on
solid foreground
hover, on
foreground hover
focus
2 px ring, 2 px out
invalid
error edge
disabled, off
faint stock, dim square
disabled, on
square stays at the end