Leave Yamada UI a star

Star
Yamada UIYamada UIv1.7.2

CheckboxCard

CheckboxCard is a component used for allowing users to select multiple values from multiple options.

Source@yamada-ui/checkbox

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

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

const items = useMemo<CheckboxCardItem[]>(
() => [
{ label: "ドラえもん", value: "ドラえもん" },
{ label: "ドラミ", value: "ドラミ" },
{ label: "ガチャ子", value: "ガチャ子" },
],
[],
)
return <CheckboxCardGroup items={items} aria-label="キャラクター" />
Copied!
const items = useMemo<CheckboxCardItem[]>(
() => [
{ label: "ドラえもん", value: "ドラえもん" },
{ label: "ドラミ", value: "ドラミ" },
{ label: "ガチャ子", value: "ガチャ子" },
],
[],
)
return (
<VStack gap="sm">
<Text as="h3" id="label">
キャラクター
</Text>
<CheckboxCardGroup items={items} aria-labelledby="label" />
</VStack>
)
Copied!

Keyboard Navigation

KeyDescriptionState
TabFocuses on a checkbox that is not disabled.-
SpaceToggles the checked state of the checkbox.-

ARIA Roles and Attributes

ComponentRoles and AttributesUsage
CheckboxCardGrouprole="group"Indicates that it is a group of checkboxes.
aria-labelledbyIf CheckboxCardGroup is within FormControl and FormControl has a label or Label set, set its id.
CheckboxCardaria-checkedSet to "true" if the checkbox is checked, "false" if it is not checked.

Edit this page on GitHub

PreviousCheckboxNextSwitch