select custom element renders a <select> populated from a static option list. Use it for merchant-defined enumerated choices.
Factory
Example
Options
CustomSelectOption
Typed option lists
Passoptions as const to narrow defaultValue to the union of supplied values:
Minimum two options
The SDK refuses to mount a<select> with fewer than two entries. Passing options: [] or options: [{...}] logs a console warning and returns a no-op handle. Every subsequent call on that handle is silently ignored.
Reserved value
The empty string'' is reserved for the placeholder slot. Any merchant-supplied options[].value === '' triggers a console warning and a no-op handle. Use placeholder when you need a “none” affordance.
Initial selection
The initial selected value resolves in this order at mount:defaultValue, when supplied and it matches one ofoptions[].value.- Otherwise, when
placeholderis set, the placeholder slot renders selected and the emitted value on first interaction isnull. - Otherwise,
options[0]is pre-selected and the emitted value on mount equalsoptions[0].value.
defaultValue that does not match any option logs a console warning and falls through to step 2 or 3.
required behavior
With required: true and no placeholder, the field never trips the empty check because a real selection is always present from mount. Pair required: true with placeholder to force shoppers to make an explicit choice.
Value
value string. Selecting the placeholder slot emits null. Submit forwards the same shape.