Select <pm-select>
Native-backed select for picking one option from a short list, with the platform picker on phones.
Sizes
Set with the size attribute; controls keep touch-sized targets on phones.
size="xs"size="sm"size="md"size="lg"size="xl"States
Each state is one attribute.
DisabledRead-onlyRequiredErrorWith a hintOverview
Options are light-DOM <option> / <optgroup> children (or the options property) mirrored into a native <select>, so it keeps the platform picker on phones and full keyboard/autofill support on desktop (customizable via appearance: base-select where supported). Set placeholder for an empty first choice. For search, multi-select or creating values use <pm-combobox>.
Options from an API: src="/api/countries" with options-path, value-key, label-key and group-key (or the loader property and mapOption) loads them once on connect, showing a loading and an error state; reload() loads them again. A value set before they arrive is kept.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
placeholder | string | — | Empty first choice shown until a value is picked (required selects then fail validation until chosen). |
autocomplete | string | — | Browser autofill hint, as on a native select (e.g. "country", "shipping country"). |
options | (string | SelectOption | { group: string; options: (string | SelectOption)[] })[] | — | Choices as data: strings, { value, label, disabled }, or { group, options: [...] }. |
src | string | — | URL of the options (JSON). |
options-pathprop: optionsPath | string | — | Where the list is in the response (dotted path; empty = the response itself). |
value-keyprop: valueKey | string | — | Item field for the value (default value, then id). |
label-keyprop: labelKey | string | — | Item field for the label (default label, then name, then title). |
group-keyprop: groupKey | string | — | Item field for the group (<optgroup>) label (default group). |
name | string | — | Form field name: the value is submitted under it. |
value | string | — | Current value (submitted with the form). |
label | string | — | Visible label (required for accessibility; use hide-label to visually hide it). |
hint | string | — | Help text under the field, linked to it for screen readers. |
error | string | — | Custom error message. Setting it marks the control invalid. |
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | — | Control size. |
required | boolean | false | The form cannot be submitted until this has a value. |
disabled | boolean | false | Not interactive and not submitted. |
readonly | boolean | false | Focusable and submitted, but not editable. |
hide-labelprop: hideLabel | boolean | false | Hide the label visually; it stays the accessible name. |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Events
| Event | React / Svelte prop | Description |
|---|---|---|
pm-load | onPmLoad | Options arrived from the server. |
pm-load-error | onPmLoadError | Loading options failed. |
pm-input | onPmInput | On every value change while editing. |
pm-change | onPmChange | When the value is committed. |
Methods
reload(), checkValidity(), reportValidity(), validate(), focus()
Used in templates
Traffic analyticsOrdersProject boardTeam and rolesBilling and invoicesUser profileAccount settingsCheckoutContactOnboarding wizard