ValyroUI Русская версия

Checkbox

Checkboxes. Free, MIT · Forms and input › Checkboxes and sliders

Native checkbox with a custom box. className/style go to the <label> wrapper, other props to the <input>.

Installation

npx valyro-cli@latest add checkbox
npx shadcn@latest add https://valyro.xyz/r/checkbox.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { Checkbox } from 'valyro-ui';

Props

PropTypeDefault
checkedbooleanControlled checked; use with onCheckedChange.
defaultCheckedbooleanfalseInitial checked when uncontrolled.
onCheckedChange(checked: boolean) => voidCalled with the new checked when it changes.
indeterminatebooleanfalseMixed state, e.g. a "select all" box with some children checked.
labelReactNodeText next to the box; clicking it toggles the checkbox, and it names the input.
descriptionReactNodeSecondary text under the label, linked to the input with aria-describedby.
size'sm' | 'md' | 'lg''md'Box and text size.
invalidbooleanfalseRed box border (red fill when checked) and aria-invalid on the input (an explicit aria-invalid wins).
animation'default' | 'spring''default'spring: the box bounces when the user toggles it, the check draws in and the mixed dash grows from the centre. default: the theme's transitions.

Related components

Previous: Checkbox Tree · Next: Checkbox Group · All Forms and input