Skip to main content

Migrate OptionList from Polaris React

Replace Polaris React OptionList with s-choice-list when choices should remain visible. Use s-select for a compact single choice. Preserve group labels, stable values, multiple selection, disabled options, and validation.


Anchor to Migrate visible optionsMigrate visible options

Migrating checkout options

<s-choice-list label="Checkout options" name="checkout" multiple>
<s-choice value="shipping" selected>
Use the shipping address as the billing address by default
<s-text slot="details">
Reduces the number of fields required to check out. The billing address
can still be edited.
</s-text>
</s-choice>
<s-choice value="confirmation">
Require a confirmation step
<s-text slot="details">
Customers must review their order details before purchasing.
</s-text>
</s-choice>
</s-choice-list>
import {OptionList} from '@shopify/polaris';

<OptionList
title="Checkout options"
allowMultiple
selected={selected}
onChange={setSelected}
options={[
{value: 'shipping', label: 'Use shipping address for billing'},
{value: 'confirmation', label: 'Require a confirmation step'},
]}
/>

Preview


Anchor to Replace OptionList propertiesReplace OptionList properties

Polaris ReactPolaris web componentsMigration notes
titlelabel on s-choice-list or s-selectKeep a label that describes the decision.
optionsExplicit s-choice or s-option childrenKeep stable values separate from translated labels.
sectionsSeparate labelled choice lists, or simplify the information architectureDon't put headings inside a compact select.
allowMultiplemultiple on s-choice-listA select destination should remain single-choice.
selectedvalues on s-choice-list or value on s-selectKeep one source of controlled state.
onChange(values)onChange(event)Read values from a choice list or value from a select.

Map per-option disabled to the child control. Put option help text in s-text slot="details" inside the corresponding s-choice. If the old list contains media, actions, or rich arbitrary content, use a resource-list pattern instead of forcing it into a form control.


  • Select and clear each option with keyboard and pointer input.
  • Verify single and multiple values submit under the intended field name.
  • Exercise option and group disabled states.
  • Trigger group validation and verify the error is announced.
  • Test long translated labels and details at narrow widths.

Anchor to Remove Polaris ReactRemove Polaris React

Remove OptionList, option and section descriptor builders, and callback adapters after every call site uses a supported control or pattern. Remove @shopify/polaris only after no other route in scope imports it.



Was this page helpful?