Ravox KitForms

Checkbox

A real checkbox with label, description and error, an indeterminate state for "select all" and a group with a legend. Sends name/value in the form and accepts React Hook Form's register() directly.

Settings

Estado
Toggles

Examples

Select all

Group in a plain form

Me avise por e-mail quando

With React Hook Form

Side by side

Baixar do pacote

O DESIGN.md sempre vai: é o que a sua IA lê.

Installation

The command creates components/ui/checkbox.tsx in your project and installs the theme with it. The file is yours: edit it as you like.

npx @ravox-ui/cli add checkbox

Props

PropTypeDefaultDescription
labelReactNode—Text next to the box; the whole row is clickable. Without a label, pass aria-label.
descriptionReactNode—Supporting line below the label, read together with the box (aria-describedby).
errorReactNode—Error message below: paints the border and sets aria-invalid.
indeterminatebooleanfalseThe dash for "some checked". The screen reader announces it as mixed.
onCheckedChange(checked: boolean) => void—Shortcut for onChange: receives only whether it is checked.
wrapperClassNamestring—Classes of the outer block; className goes on the input.
...propsComponentProps<"input">—Everything a checkbox accepts (name, value, checked, defaultChecked, ref): {...register("terms")} works.
CheckboxGroup legendReactNode—Group title (<fieldset> + <legend>).
CheckboxGroup namestring—name of all the boxes; the form receives one value per checked box (FormData.getAll).
CheckboxGroup value / defaultValue / onValueChangestring[]—Checked values (controlled or initial); each <Checkbox> needs a value.
CheckboxGroup orientation"vertical" | "horizontal""vertical"One below the other or side by side (wraps).
CheckboxGroup hint / errorReactNode—Note below the group; with an error, all unchecked boxes get the error border.

More in Forms