Collection of theme-ui and external components.
created:3/15/2021
updated:3/15/2021
source lines:71
comments %:0

Switch

Form switch component

Switch variants can be defined in

theme.forms
and the component uses the
theme.forms.switch
variant by default.

Overview

({
label,
checked: propChecked,
}) => {
const [checked, setChecked] = useState(propChecked);
return (
<Switch
label={label}
checked={checked}
onChange={() => setChecked(!checked)}
/>
);
}

Controls

Name
Description
Default
Controls
SwitchProps (1 properties)
label
string
-
InputHTMLAttributes (1 properties)

A11y tests

Viewport

320px

375px

768px

1024px