Skip to content

Select

A styled native <select>: the browser owns the popup, keyboard, typeahead, form participation and the platform picker on mobile. This layer styles the closed control and adds label, placeholder, width modes and the invalid state.

Options are plain text by design — the native popup can’t render markup. For per-option icons, rich option content or a styled popup, use the Combobox (optionally with the search hidden): that is the custom, advanced select.

They share the popup mechanics, but they are different components with different semantics:

  • Select is a form control: it picks a value that persists, is announced as selected, submits with the form natively (it is a real <select name>, so the browser also runs required validation), and supports label / required / error.
  • Dropdown Menu is a menu of actions: its items run commands (role="menu" / role="menuitem"), nothing stays selected and no form value exists.

Rule of thumb: if “what’s in the field right now?” makes sense, use Select; if the items are verbs (Rename, Delete, Share…), use Dropdown Menu.

<script>
import Select from "@invisible-ui/svelte/Select.svelte";
</script>
PropTypeDefaultDescription
label *string—Accessible name for the control.
hideLabelbooleanfalseVisually hide the label (kept for assistive tech) — for compact toolbars.
items *SelectItem[]—Options ({ value, label?, disabled? }); label falls back to value.
valuestring | nullnullSelected value.
placeholderstring | undefinedundefinedTrigger text when nothing is selected.
disabledbooleanfalseDisable the control.
width"wrap" | "fill" | "fixed""wrap"Width behaviour: wrap fits the longest option (plus the trigger padding), fill takes 100% of the container, fixed uses --ds-select-width (16rem by default).
namestring | undefinedundefinedForm field name — the selected value is submitted under it (via a hidden input).
requiredbooleanfalseMarks the control as required (announced to assistive tech).
errorstring | undefinedundefinedError message; when non-empty the select becomes invalid and announces it.
onValueChange((value: string) => void) | undefinedundefinedCalled whenever the selected value changes.
  • A real <select>: the browser provides the popup, keyboard, typeahead, screen-reader semantics, required validation and the mobile picker.
  • The visible label is a <label for>; error maps to aria-invalid plus an announced description.
<Select
label="Country"
items={[
{ value: "it", label: "Italy" },
{ value: "fr", label: "France" },
]}
onValueChange={(v) => (country = v)}
/>

Themeable via --ds-select-*.