ComponentsCheckBox

CheckBox

A Checkbox is a mechanism that allows the user to select one or more options. Usually used in a Checkbox Group to present the user with a range of options from which the user <b>may select any number of options</b> to complete their task. It can also be used individually to represent the toggle of a single option, when the Toggle Switch and Toggle Button aren't more appropriate.

GitHub LogoSource Code

States

Disabled

Readonly

Required

Invalid

No way for this to be valid!
No way for this to be valid!
No way for this to be valid!

No label

Semantic

Controlled

Controlled checkbox. Clicking the Checkbox 1 does nothing, while clicking Checkbox 2 changes both inputs.

External error message

A form element can be invalid but render its error message elsewhere. For instance if a business rule error relates to the combination of two or more fields, or if we want to display all the form errors together in a summary section. The aria-errormessage property should reference another element that contains error message text. It can be used when controlling the validation status or when relying on the built-in validations, but the message text computation is reponsability of the app.

Form errors:

  • No way for the second checkbox to be valid!