Homecomponentsinput

Checkbox

An input that toggles between on and off states.


Use Checkbox for selecting multiple values from several options.

Disabled

Use disabled property to disable the checkbox.

Indeterminate

Use checked='indeterminate' property to visualize state between not checked and checked.

Pass a boolean array as checked property. If items include both true and false values the Checkbox will have an indeterminate state. Otherwise it'll be just checked/unchecked.


Overflowing Text

The checkbox will remain aligned to the first line of text.

API

name
Required
Name for the checkbox input.
string

checked
Required
Sets the state of the checkbox. `indeterminate` shows a horizontal line in the checkbox. Use onChange to update its value.
CheckboxValue

children
Required
The content of the checkbox.
ReactNode

id
ID for the checkbox input.
string

value
Value for the checkbox input.
string

required
Indicates that the checkbox is invalid unless checked.
true
false

disabled
Prevents the user from interacting with the checkbox.
true
false

bordered
Is the element contained in a bordered container.
true
false

onChange
Called when the checkbox's value is changed by the user.
((value: boolean | "indeterminate") => void)

onBlur
Action to perform when the field is blurred.
FocusEventHandler<HTMLButtonElement>

data
An object with the data keys and values.
DataAttributeMap

ref
Ref<HTMLButtonElement>

key
Key | null