Switch

@sushindustries/ui

A checkbox that admits it: a real input with role=switch, and a track :checked drives.

4 min read
View as MarkdownEdit on GitHub

Props

Accepts every prop of Omit<InputHTMLAttributes<HTMLInputElement>, "type">, plus:

PropTypeDefaultDoes
labelstring-

Notes

The input underneath is a real <input type="checkbox">, so every native checkbox prop applies as-is - defaultChecked, checked, onChange, disabled, required. type is not in the prop list because it is fixed; there is no way to make this render anything other than role="switch" on a checkbox.