Skip to content

Select

Picks a value from a known list. It isn’t the native <select>—it supports groups, built-in search, multiple selection, and options with an icon and description. The panel lives in the browser’s top layer (Popover API).

Forms · TaishoDS Core, in plain HTML.

Examples

One working example per case. Each example is the HTML of its preview—copy it as is, and with Core’s CSS and JS loaded, it looks and works the same.

Member role with an unavailable option

Invite as
html

Clearable with a value

Project
html

Read-only

Environment
html

Loading

Owner
html

Multiple selection

Notify
html

With icons and descriptions

Plan
html

Required with hint

Role
html

Disabled

Billing
html

Required with no value

Initial permission
html

Class reference

Every value of each modifier, with its HTML ready to copy.

Size

Field height: sm, md, or lg.

html

Variant

The border color for validation: default, success, warning, info, or danger.

html

Density

The field’s inner spacing.

html

States

is-disabled, is-readonly, is-loading, and the selected option.

html

Combinations

Size, variant, and density combined.

html

When to use

  • You pick one or more items from a known, bounded set that can be scanned at a glance.
  • You need multiple selection or a search box inside the panel.
  • It’s a form field. The chosen value stays and gets submitted.

When not to use

  • The list is long and typing to filter is the main interaction → combobox.
  • The user needs to enter a value that isn’t in the list → combobox with data-ts-allow-custom.
  • You’re not choosing a value but triggering an action → menu.

Do

  • Label it with the field markup, which ties the label, hint, and error to the control.
  • Order the options deliberately (by frequency or alphabetically), and group them if there are many.

Don’t

  • Don’t use it for two or three mutually exclusive options that should always be visible → segmented-control or radio.
  • Don’t mix actions (“Edit,” “Delete”) into the options. A Select chooses; it doesn’t execute.

TaishoDS Core

Needs Core’s JS, which handles focus, keyboard, and state.

It’s its own list of options, not a native <select>. It has keyboard support, typeahead, and multiple selection.

Core hooks into it through these attributes. They go in the markup, and there’s nothing to initialize.

  • data-ts-clear
  • data-ts-count-suffix
  • data-ts-listbox
  • data-ts-listbox-label
  • data-ts-listbox-loading
  • data-ts-listbox-native
  • data-ts-listbox-panel
  • data-ts-listbox-spinner
  • data-ts-listbox-template
  • data-ts-listbox-trigger
  • data-ts-listbox-value
  • data-ts-multiple
  • data-ts-placeholder
  • data-ts-required-proxy
  • data-ts-value

What it does: A complete option list (APG listbox pattern)—opening and closing, focus, ↑ ↓, Home, End, typeahead, multiple selection, a clear button, and positioning. Tab with the panel open closes it, and focus moves on. The trigger text and the is-placeholder state come from the selection.

Attribute What it does
data-ts-count-suffixWith several options chosen, the trigger reads “3 selected”. The suffix comes from this attribute.
data-ts-clearA button that clears the selection.
aria-readonly="true" (on the trigger)Read-only. It doesn’t open or select, and shows neither the chevron nor the clear button.
setSelectLoading(root, true | false)Sets is-loading, aria-busy, the Spinner, and the “Loading…” message.
data-select-option-icon, data-select-option-descriptionOptions with an icon and a description: markup and CSS.

From the CDN, without a build, load taisho.select.css along with taisho.base.css. Also load:

  • taisho.button.css
  • taisho.checkbox.css
  • taisho.icon.css
  • taisho.input.css
  • taisho.kbd.css
  • taisho.spinner.css

For how Core works in general, see Behavior.

Accessibility

Implements the Combobox pattern from the WAI-ARIA APG.

  • The trigger is a <button> with role="combobox" and aria-expanded.
  • Keyboard navigation: arrow keys to move, Enter to select, and Esc to close.
  • required paints the label’s asterisk (decorative, aria-hidden) and sets aria-required="true" on the trigger, which the combobox role supports. Since native required doesn’t apply to a <button>, it also adds an <input data-ts-required-proxy> with no name, invisible, aria-hidden, and out of the Tab order. It blocks submitting the empty form with the browser’s native message and moves focus to the trigger. It doesn’t validate when disabled or readonly. With disabled, the value isn’t submitted with the form.
  • The clear button (data-ts-clear) is a sibling of the trigger (a <button> can’t contain another one). It comes right after the trigger in the Tab order, has its own aria-label, and only shows with a selection and without disabled. Activating it with Enter or Space clears the selection (all of it, in multiple mode), and focus returns to the trigger.
  • readonly sets aria-readonly="true" on the trigger. It stays focusable, but doesn’t open the panel with the mouse or the keyboard, and shows neither the chevron nor the clear button. The value is still submitted with the form.
  • For the loading state, call setSelectLoading(root, true|false). It sets is-loading and aria-busy="true" on the trigger and the panel, and adds a Spinner in the field (role="status") and “Loading…” in the panel. It doesn’t block the field or hide the options. If you set only the class, it isn’t announced.
  • Options with a description are named by their label (aria-labelledby) and described with aria-describedby. The icon is decorative (aria-hidden). The trigger shows only the label.

Keyboard

On top of what the browser already does (Tab moves focus, Enter activates a button).

Key What it does
↑↓Move through the options.
HomeEndGo to the first or last enabled option.
Enter/SpaceSelects the highlighted option.
EscCloses without changing the selection.
TabCloses the panel, and focus moves on. The options aren’t tabbable.

Verification

What was actually tested. Anything that wasn’t tested says so—we’d rather say “not verified” than claim too much.

  • axe WCAG 2.2 A + AA in a real browser, in light and dark mode, before every release.
  • keyboard Key map documented above, checked against the component.
  • screen reader Not verified with a screen reader. Test it in your own combination of components, not just here, where each one appears alone and on its happy path.