Skip to main content

Select

Allow users to pick one option from a menu. Ideal when presenting four or more choices to keep interfaces uncluttered.

string

Additional text to provide context or guidance for the field. This text is displayed along with the field and its label to offer more information or instructions to the user.

This will also be exposed to screen reader users.

boolean
Default: false

Disables the field, disallowing any interaction.

Anchor to disconnectedCallback
disconnectedCallback
() => void
string

Indicate an error to the user. The field will be given a specific stylistic treatment to communicate problems that have to be resolved immediately.

"" | "replace" | "search" | "split" | "link" | "edit" | "product" | "variant" | "collection" | "select" | "info" | "incomplete" | "complete" | "color" | "money" | "adjust" | "affiliate" | "airplane" | "alert-bubble" | "alert-circle" | "alert-diamond" | "alert-location" | "alert-octagon" | "alert-octagon-filled" | "alert-triangle"

The type of icon to be displayed in the field.

string

A unique identifier for the element.

string

Content to use as the field label.

Anchor to labelAccessibilityVisibility
labelAccessibilityVisibility
"visible" | "exclusive"
Default: 'visible'

Changes the visibility of the component's label.

  • visible: the label is visible to all users.
  • exclusive: the label is visually hidden but remains in the accessibility tree.
string

An identifier for the field that is unique within the nearest containing form.

string

A short hint that describes the expected value of the field.

boolean
Default: false

Whether the field needs a value. This requirement adds semantic value to the field, but it will not cause an error to appear automatically. If you want to present an error when this field is empty, you can do so with the error property.

string

The current value for the field. If omitted, the field will be empty.

Was this section helpful?

Learn more about registering events.

<'input'>
<'input'>
Was this section helpful?

HTMLElement

The options a user can select from.

Accepts Option and OptionGroup components.

Was this section helpful?

Represents a single option within a select component. Use only as a child of s-select components.

boolean
Default: false

Whether the control is active by default.

boolean
Default: false

Disables the control, disallowing any interaction.

boolean
Default: false

Whether the control is active.

string

The value used in form data when the control is checked.

Was this section helpful?

HTMLElement

The content to use as the label.

Was this section helpful?

Represents a group of options within a select component. Use only as a child of s-select components.

boolean
Default: false

Whether the options within this group can be selected or not.

string

The user-facing label for this group of options.

Was this section helpful?

HTMLElement

The options a user can select from.

Accepts Option components.

Was this section helpful?

Code

<s-select label="Date range">
<s-option value="1">Today</s-option>
<s-option value="2">Yesterday</s-option>
<s-option value="3">Last 7 days</s-option>
<s-option-group label="Custom ranges">
<s-option value="4">Last 30 days</s-option>
<s-option value="5">Last 90 days</s-option>
</s-option-group>
</s-select>

Component examples

A simple select dropdown with pre-selected value for product sorting options.

Select dropdown with helpful placeholder text guiding category selection.

Select in error state showing specific business context and actionable error message.

Grouped select options organized by geographical regions for international shipping.

Select dropdown with sort icon for filtering order management views.

Select in disabled state preventing user interaction with pre-selected value.

Was this section helpful?

Basic usage

<s-select label="Sort products by" value="newest">
<s-option value="newest">Newest first</s-option>
<s-option value="oldest">Oldest first</s-option>
<s-option value="title">Title A–Z</s-option>
<s-option value="price-low">Price: low to high</s-option>
<s-option value="price-high">Price: high to low</s-option>
</s-select>