Checkbox
A checkbox under a cap of clear glass: the box and its mark are always seen through the lens.
checkbox.tsx
Use it for
- Choosing any number of items in a list or a form.
- Agreeing to something that is submitted later.
Not for
- A setting that takes effect at once: use Switch.
- One choice out of several: use Tabs.
Installation
Coming soon
npm install @vitrumui/reactNo dependencies
Usage
app.tsx
import { Checkbox } from '@vitrumui/react/controls/checkbox'
const [remember, setRemember] = useState(true)
<Checkbox label="Remember this device" checked={remember} onChange={setRemember} />The glass cap is there at rest, not only while pressed. Needs three, like Slider.
Examples
Coming soon
API reference
| Prop | Type | Default |
|---|---|---|
checkedChecked or not. | boolean | true |
onChangeCalled with the new state. | (checked: boolean) => void | — |
labelText beside the box; an empty string leaves the box alone. | string | 'Remember this device' |
descriptionA second, quieter line under the label. | string | — |
shapeA rounded square or a circle. | 'rounded' | 'circle' | 'rounded' |
sizeBox size 18, 22 or 28 px. | 'sm' | 'md' | 'lg' | 'md' |
colorThe box while checked: a hex, | string | '#3291FF' |
themeOverrides the page theme for this checkbox. | 'light' | 'dark' | — |
disabledDimmed and not interactive. | boolean | false |
swellHow much the cap grows while pressed. | number | 1.18 |
Accessibility
- A
<button role="checkbox">witharia-checked: Space toggles it. - The
labelis a real<label>tied to the button. - With reduced motion the mark and the cap change without springs.