Native Select
View as MarkdownStyle a native select while preserving platform behavior. CSS only
<div class="ui-field"> <label class="ui-label" for="channel">Release channel</label> <div data-ui-part="control"> <select class="ui-select" id="channel" name="channel"> <option value="preview">Preview</option> <option value="stable" selected>Stable</option> </select>
</div></div>Install
import '@timelessui/components/css/tokens.css'import '@timelessui/components/css/core/forms.css'import '@timelessui/components/css/themes/atmosphere/tokens.css'import '@timelessui/components/css/themes/atmosphere/forms.css'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.
ui-field
| Part | Required | Selector | Purpose |
|---|---|---|---|
control | No | [data-ui-part~='control'] | Wrapper around the native control when one is needed. |
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.
ui-select
| Attribute | Values | Default | Description |
|---|---|---|---|
data-ui-size | sm · md · lg | md | Control height, padding, font size, and the size of the drop-down indicator. |
ui-field
| Attribute | Values | Default | Description |
|---|---|---|---|
data-ui-layout | stacked · inline | stacked | Whether the label sits above the control or beside it. |
data-ui-density | compact · normal · spacious | normal | Gap between label, control, description, and error. |
State
Native attributes, ARIA, and platform pseudo-classes are authoritative. Style state through the selectors below rather than adding your own state classes.
| State | Source | How to express it |
|---|---|---|
invalid | native | Native :invalid, or aria-invalid="true". |
disabled | native | Native disabled. |
invalid | aria | Set aria-invalid="true" on the control and point aria-describedby at the error part. |
Styling
Root identity: ui-select, ui-field, ui-label. Required stylesheets: tokens.css, core/forms.css, themes/atmosphere/tokens.css, themes/atmosphere/forms.css.
Set these custom properties to restyle the component:
| Custom property | Controls |
|---|---|
--ui-select-indicator | Width of the drop-down indicator, which also sets the end padding reserved for it. Timeless draws the mark itself with appearance: none, because the platform arrow sits at a fixed engine-chosen offset no author padding moves, and WebKit drops padding and min-block-size on a UA-drawn select entirely. The mark is two gradient halves rather than an icon asset, so it follows currentColor; redeclare background-image to replace it. The drop-down list itself is still UA-drawn, which is what color-scheme on the control is for. |
Design tokens this component reads (26)
These are global Atmosphere tokens. Change them once at the theme level rather than per component.
--ui-accent · --ui-bg-control · --ui-bg-control-muted · --ui-bg-surface · --ui-bg-surface-subtle · --ui-danger · --ui-danger-soft · --ui-disabled-opacity · --ui-duration-fast · --ui-ease-standard · --ui-fg · --ui-fg-muted · --ui-fg-subtle · --ui-focus · --ui-line · --ui-line-strong · --ui-radius-md · --ui-radius-pill · --ui-radius-sm · --ui-shadow-control · --ui-shadow-inset · --ui-space-1 · --ui-space-2 · --ui-space-3 · --ui-space-4 · --ui-space-5
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.
This component declares no keyboard contract, because it has none of its own: the markup above is native elements and native ARIA, and everything a keyboard or a screen reader does with it comes from the platform. Nothing here manages focus, and nothing here adds a role you did not author. So the accessibility of this component is the accessibility of the markup — which is why the markup is the part worth copying exactly.
Before JavaScript runs
This primitive is CSS only. There is nothing to register and nothing to wait for.
More examples
Open Native Select in StoryLite for variants, controls, and manual testing.