Checkbox

Native checkbox with optional label and description, including indeterminate.

Also known as: tick box, indeterminate checkbox

Installation

Install with the CLI, or copy the component source into your project.

Add checkbox (npm)

npx --yes -p github:itsvigneshv/default-file-ui#main df-ui add checkbox

Properties

Native checkbox with optional label and description, supporting checked, unchecked, and indeterminate.

Checkbox

PropTypeDefaultNotes
checkedboolean | "indeterminate"-Controlled state. Pass "indeterminate" for the mixed visual and aria-checked="mixed".
defaultCheckedbooleanfalseUncontrolled initial checked state.
onCheckedChange(checked: boolean | "indeterminate") => void-Called when the user toggles. Interaction always commits true or false; indeterminate is set from the parent.
size"sm" | "md""md"Control size.
invalidbooleanfalseMarks the control invalid and sets aria-invalid.
labelReactNode-Visible label. When set (or description is set), the control wraps in a label element bound with htmlFor.
descriptionReactNode-Supporting text under the label. Wired as aria-describedby on the input.
disabledboolean-Disables the input.
idstring-Input id. Generated when omitted.
namestring-Form name on the input.
valuestring-Form value on the input.
requiredboolean-Native required on the input.
classNamestring-Additional styles on the field wrapper when label or description is set, otherwise on the control root.

Accessibility

Pass label for a visible name, or supply aria-label or aria-labelledby on the input when rendering the control alone. Also accepts other native input attributes except type, size, checked, defaultChecked, and onChange; use onCheckedChange for selection changes.