skip to the page
superthread
componentsswitch
system
superthread
version
2.15.1
date
24.11.26

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/switch

example

turn completion notices on or off. the words belong to the label, so clicking them changes the switch too.

light

completion notices are on

dark

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.

light

sm
24 × 14 px

default
32 × 18 px

dark

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.

light

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

dark

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