Leave Yamada UI a star

Star
Yamada UIYamada UIv1.7.2

Select

Select is a component used for allowing a user to choose one option from a list.

Source@yamada-ui/select

The Select follows the WAI-ARIA - Combobox Pattern for accessibility.

If you are not using FormControl, set aria-label or aria-labelledby to Select.

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

Keyboard Navigation

KeyDescriptionState
ArrowUpFocuses the previous non-disabled item. If on the first item, focuses the last non-disabled item.-
ArrowDownFocuses the next non-disabled item. If on the last item, focuses the first non-disabled item.-
HomeFocuses the first non-disabled item.-
EndFocuses the last non-disabled item.-
Space, EnterSelects the focused item and closes the listbox.closeOnSelect={true}
EscapeCloses the listbox.closeOnEsc={true}

ARIA Roles and Attributes

ComponentRoles and AttributesUsage
SelectField Internalrole="combobox"Indicates that this is a combobox.
aria-haspopup="listbox"Indicates that a listbox exists.
aria-activedescendantSet to the id of the focused item.
aria-expandedSet to "true" when the listbox is open, "false" when closed.
aria-controlsSet to the id of the related SelectList when open, undefined when closed.
aria-readonlySet to "true" when isReadOnly is set.
aria-disabledSet to "true" when isDisabled is set.
aria-invalidSet to "true" when isInvalid is set.
aria-requiredSet to "true" when isRequired is set.
SelectList Internalrole="listbox"Indicates that this is a listbox.
idThe id used to associate with SelectField.
aria-hiddenSet to "true" when the listbox is open, "false" when closed.
OptionGrouprole="group"Indicates that this is a group.
aria-labelledbySets the id of the associated OptionGroupLabel.
OptionGroupLabel Internalrole="presentation"Indicates that this is a presentation.
idThe id used to associate with OptionGroup.
Optionrole="option"Indicates that this is an option.
idThe id used to associate with SelectField.
aria-selectedSet to "true" when the option is selected, "false" when not selected.
aria-disabledSet to "true" when isDisabled is set.

Edit this page on GitHub

PreviousToggleNextMultiSelect