Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Forms Form-associated

Select <pm-select>

Native-backed select for picking one option from a short list, with the platform picker on phones.

Full screen

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/select'; </script> <pm-select label="Country" name="country" placeholder="Choose a country" required> <optgroup label="Europe"> <option value="de">Germany</option> <option value="se">Sweden</option> </optgroup> <optgroup label="Asia"> <option value="in">India</option> <option value="jp">Japan</option> </optgroup> </pm-select>

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.

Disabled
Read-only
Required
Error
With a hint

Overview

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

AttributeTypeDefaultDescription
placeholderstring—Empty first choice shown until a value is picked (required selects then fail validation until chosen).
autocompletestring—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: [...] }.
srcstring—URL of the options (JSON).
options-path
prop: optionsPath
string—Where the list is in the response (dotted path; empty = the response itself).
value-key
prop: valueKey
string—Item field for the value (default value, then id).
label-key
prop: labelKey
string—Item field for the label (default label, then name, then title).
group-key
prop: groupKey
string—Item field for the group (<optgroup>) label (default group).
namestring—Form field name: the value is submitted under it.
valuestring—Current value (submitted with the form).
labelstring—Visible label (required for accessibility; use hide-label to visually hide it).
hintstring—Help text under the field, linked to it for screen readers.
errorstring—Custom error message. Setting it marks the control invalid.
size'xs' | 'sm' | 'md' | 'lg' | 'xl'—Control size.
requiredbooleanfalseThe form cannot be submitted until this has a value.
disabledbooleanfalseNot interactive and not submitted.
readonlybooleanfalseFocusable and submitted, but not editable.
hide-label
prop: hideLabel
booleanfalseHide 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

EventReact / Svelte propDescription
pm-loadonPmLoadOptions arrived from the server.
pm-load-erroronPmLoadErrorLoading options failed.
pm-inputonPmInputOn every value change while editing.
pm-changeonPmChangeWhen the value is committed.

Methods

reload(), checkValidity(), reportValidity(), validate(), focus()

Used in templates

Traffic analyticsOrdersProject boardTeam and rolesBilling and invoicesUser profileAccount settingsCheckoutContactOnboarding wizard