toggle
a button that remembers whether it is pressed. pressed prints a foreground edge and a tick, and the words stay put.
bunx --bun shadcn@latest add @mk/toggleexample
pin an orbit run to keep it at the top. click, enter or space changes the pressed state.
run 024 follows the board order
run 024 follows the board order
variants
default rests without a visible edge. outline keeps the input edge. each pair shows rest beside pressed.
default
no visible rest edge
outline
input edge at rest
default
no visible rest edge
outline
input edge at rest
sizes
small, default and large match the button heights: 32, 40 and 48 px.
sm
32 px high
default
40 px high
lg
48 px high
icon
a square of one glyph, 32, 40 or 48 px; the edge says pressed
sm
32 px high
default
40 px high
lg
48 px high
icon
a square of one glyph, 32, 40 or 48 px; the edge says pressed
states
hover changes the fill, focus draws an outside ring, and pressed holds its box. invalid uses the error edge; disabled dims the label.
rest
quiet outline
hover
control hover fill
focus
2 px ring, 2 px out
pressed
foreground edge, tick
invalid
error edge
disabled
faint stock, dim label
disabled, pressed
pressed box stays visible
rest
quiet outline
hover
control hover fill
focus
2 px ring, 2 px out
pressed
foreground edge, tick
invalid
error edge
disabled
faint stock, dim label
disabled, pressed
pressed box stays visible