Skip to main content

ChoiceList

Presents multiple options for single or multiple selections. Use when merchants need to choose from a defined set of options in forms or filtering interfaces.

string

A unique identifier for the element.

boolean
Default: false

Whether multiple choices can be selected.

string[]

An array of the values of the selected options.

This is a convenience prop for setting the selected prop on child options.

Was this section helpful?

Learn more about registering events

(event: <"s-choice-list">) => void

Callback when the user changes a choice. Fires simultaneously with onInput.

(event: <"s-choice-list">) => void

Callback when the user changes a choice. Fires simultaneously with onChange.

Was this section helpful?

Creates options that let merchants select one or multiple items from a list of choices.

boolean
Default: false

Disables the control, disallowing any interaction.

string

A unique identifier for the element.

boolean
Default: false

Whether the control is active.

string

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

Was this section helpful?

Code

<s-choice-list>
<s-choice value="s" selected>Small</s-choice>
<s-choice value="m">Medium</s-choice>
<s-choice value="l">Large</s-choice>
<s-choice value="xl">Extra large</s-choice>
</s-choice-list>

Preview

ChoiceList usage patterns

Enable multiple selection mode with controlled values

Handle onChange and onInput events.

Was this section helpful?

Multiple selection

<s-choice-list
multiple
values={['small', 'medium']}
onChange={(event) => console.log('Selected:', event.target.values)}
>
<s-choice value="small">Small</s-choice>
<s-choice value="medium">Medium</s-choice>
<s-choice value="large">Large</s-choice>
</s-choice-list>