Leave Yamada UI a star

Star
Yamada UIYamada UIv1.7.2

Checkbox

Checkbox is a component used for allowing users to select one option from multiple choices.

Source@yamada-ui/checkbox

The Checkbox follows the WAI-ARIA - Checkbox Pattern for accessibility.

If you are not using Fieldset, set aria-label or aria-labelledby to CheckboxGroup.

<CheckboxGroup aria-label="キャラクター">
<Checkbox value="孫悟空">孫悟空</Checkbox>
<Checkbox value="ベジータ">ベジータ</Checkbox>
<Checkbox value="フリーザ">フリーザ</Checkbox>
</CheckboxGroup>
Copied!
<VStack gap="sm">
<Heading as="h3" id="label">
キャラクター
</Heading>
<CheckboxGroup aria-labelledby="label">
<Checkbox value="孫悟空">孫悟空</Checkbox>
<Checkbox value="ベジータ">ベジータ</Checkbox>
<Checkbox value="フリーザ">フリーザ</Checkbox>
</CheckboxGroup>
</VStack>
Copied!

Keyboard Navigation

KeyDescriptionState
TabFocuses on a checkbox that is not disabled.-
SpaceToggles the checked state of the checkbox.-
Toggles the checkbox between three states (checked, unchecked, indeterminate).isIndeterminate={true}

ARIA Roles and Attributes

ComponentRoles and AttributesUsage
CheckboxGrouprole="group"Indicates that it is a group of checkboxes.
aria-labelledbyIf CheckboxGroup is within FormControl and FormControl has a label or Label set, set its id.
CheckboxidThe id used to associate with a checkbox that has isIndeterminate={true} set.
aria-checkedSet to "true" if the checkbox is checked, "false" if it is not checked, and "mixed" if it is in an indeterminate state.
aria-controlsSet the id of the checkbox to be controlled if isIndeterminate={true} is set.

Edit this page on GitHub

PreviousRadioCardNextCheckboxCard