Select
Enhance authored trigger, value, and listbox anatomy. Custom element
<ui-select value="ready"> <label id="release-status-label">Release status</label> <input type="hidden" name="status" value="ready"> <button class="ui-button" data-ui-part="trigger" type="button" aria-labelledby="release-status-label"> <span data-ui-part="label">Ready</span> </button> <div id="release-status-listbox" role="listbox" popover="auto"> <div role="option" data-ui-value="draft">Draft</div> <div role="option" data-ui-value="ready">Ready</div> <div role="option" data-ui-value="published">Published</div> </div></ui-select>Install
import '@timelessui/components/css/tokens.css'import '@timelessui/components/css/button.css'import '@timelessui/components/css/select.css'import '@timelessui/components/css/listbox.css'import '@timelessui/components/css/popover.css'import '@timelessui/components/define/ui-select'Anatomy
Parts are authored in your own markup and identified by the selector below, so your CSS can target the same anatomy without loading Timeless styles. Required parts must be present for the component to work. Private data-ui-internal-* hooks are written by the runtime and must never be authored.
| Part | Required | Selector | Purpose |
|---|---|---|---|
trigger | Yes | [data-ui-part~='trigger'] | Native button that opens the listbox. |
listbox | Yes | [role='listbox'] | The option container and popover surface. |
option | Yes | [role='option'] | One option. Its value comes from value, then data-ui-value, then the element id. |
label | No | [data-ui-part~='label'] | Element inside the trigger that shows the selected label. |
Attributes
Every value below is implemented by the stylesheets this component ships. Boolean attributes are presence-based: author the attribute with no value, or omit it.
| Attribute | Values | Default | Description |
|---|---|---|---|
open | presence | absent | Present to render the listbox open on load. |
placement | bottom · top · right · left | bottom | Preferred side of the trigger for the listbox surface. |
value | any string | — | The option selected on load and after a form reset. Mirror it onto a hidden input to submit with a form. |
Element API
Attributes above are the authoring surface. These are the DOM properties and events the registered element adds once it upgrades.
<ui-select>
| Property | Type | Notes |
|---|---|---|
open | boolean | Reflects the open attribute, documented above. |
placement | 'bottom' | 'top' | 'right' | 'left' | Reflects the placement attribute, documented above. |
defaultValue | string | Reflects the value attribute, documented above. |
value | string | Live value. Assigning it does not rewrite the authored default and does not dispatch transition events. |
| Event | Detail | Description |
|---|---|---|
ui-before-change | CustomEvent<SelectChangeDetail> | Cancelable proposal dispatched before the selected option changes. Call preventDefault() to reject the transition and keep the current value. |
ui-change | CustomEvent<SelectChangeDetail> | Dispatched after the selected option has changed. Bubbles and is composed. |
Styling
Root identity: ui-select. Required stylesheets: tokens.css, button.css, select.css, listbox.css, popover.css.
This component adds no custom properties of its own. Restyle it through the design tokens or your own CSS.
Design tokens this component reads (34)
These are global Atmosphere tokens. Change them once at the theme level rather than per component.
--ui-accent · --ui-accent-soft · --ui-bg-accent · --ui-bg-accent-active · --ui-bg-accent-hover · --ui-bg-control · --ui-bg-control-active · --ui-bg-control-hover · --ui-bg-control-muted · --ui-bg-danger · --ui-bg-danger-active · --ui-bg-danger-hover · --ui-bg-surface · --ui-bg-surface-raised · --ui-disabled-opacity · --ui-duration-fast · --ui-ease-standard · --ui-fg · --ui-fg-muted · --ui-focus · --ui-line · --ui-radius-control · --ui-radius-lg · --ui-radius-md · --ui-radius-sm · --ui-shadow-control-accent · --ui-shadow-control-active · --ui-shadow-control-danger · --ui-shadow-floating · --ui-shadow-outline-control · --ui-space-1 · --ui-space-2 · --ui-space-3 · --ui-space-4
Accessibility
Keep the native elements, roles, and relationships shown in the example. Timeless adds only the state and keyboard coordination the platform does not already provide, and it never supplies your accessible names — those depend on your content.
Follows the Select-Only Combobox pattern from the ARIA Authoring Practices Guide.
| Key | Action |
|---|---|
| Enter / Space | Open the listbox, or commit the active option when it is already open. |
| Arrow keys | Move the active option while the listbox is open. |
| Escape | Close the listbox without changing the value. |
| Printable characters | Typeahead over the option labels. |
The trigger keeps focus and the active option is announced through aria-activedescendant. Light dismiss comes from the Popover API. Mirror value onto a hidden input to submit with a form.
Before JavaScript runs
The markup above is complete and usable on its own: native controls submit, labels associate, and authored ARIA is already correct. Registration adds state synchronisation, focus management, and keyboard coordination on top of it.
More examples
Open Select in StoryLite for variants, controls, and manual testing.