ComponentsProNew

Glossy Switch

A tactile switch with a heavy knob that slides over to reveal a lit window. Works as a real checkbox, keyboard included.

Customize

accentColor

Based on witty-fly-56 by csemszepp (MIT license) ยท Terms of use

Props

9 properties
PropertyTypeDefaultDescription
defaultCheckedbooleantrueWhether the switch starts on.
checkedbooleanโ€”Controlled state. Without it the switch keeps its own state.
onCheckedChange(checked: boolean) => voidโ€”Called with the new state after every flip.
widthnumber160Width in pixels; the height is width / 2.5.
accentColorstring"#f5f5f5"Color of the lit window when on.
durationnumber0.6Seconds for the knob to slide.
disabledbooleanfalseDisable the switch.
labelstring"Toggle"Accessible name of the switch.
classNamestringโ€”Classes for the wrapper.

Dependencies

2 required packages

npm install clsx tailwind-merge

Related components

View all