Checkboxes
Checkboxes allow the user to select multiple options from a set.
Controlled
function Example() {
const \[checked, setChecked\] \= React.useState(false);
return (
<Checkbox
label\="Cookies"
checked\={checked}
onChange\={(evt) \=> setChecked(!!evt.currentTarget.checked)}
/>
);
}
Uncontrolled
<Checkbox label\="Pizza" />
Label as Child
<Checkbox\>Icecream</Checkbox\>
States
<\>
<Checkbox label\="Broccoli" indeterminate />
<Checkbox label\="Always On" checked />
<Checkbox label\="Always Off" checked\={false} />
</\>
Checkbox