Choice
Options inside a .
The wrapping component will dictate if the choice renders as radio buttons or checkboxes.
Anchor to choicepropsChoiceProps
- stringrequired
A unique identifier for the choice.
- Anchor to disableddisabledboolean
Whether the choice can be changed.
- Anchor to accessibilityLabelaccessibilityLabelstring
A label used for buyers using assistive technologies. When set, any
children
supplied to this component will not be announced to screen reader users.- Anchor to detailsdetailsstring | RemoteFragment<RemoteRoot<any, any>>
Additional content to be revealed when selected.
- Anchor to primaryContentprimaryContentstring | RemoteFragment<RemoteRoot<any, any>>
The primary content for a choice. Rendered below
<label>
.- Anchor to secondaryContentsecondaryContentstring | RemoteFragment<RemoteRoot<any, any>>
The secondary label content for a choice in a
group
ChoiceList. Ignored inbase
variant. Rendered on the opposite side to- Anchor to tertiaryContenttertiaryContentstring | RemoteFragment<RemoteRoot<any, any>>
The tertiary label content for a choice in a
group
ChoiceList. Ignored inbase
variant. Rendered belowand
.
ChoiceProps
- id
A unique identifier for the choice.
string
- disabled
Whether the choice can be changed.
boolean
- accessibilityLabel
A label used for buyers using assistive technologies. When set, any `children` supplied to this component will not be announced to screen reader users.
string
- details
Additional content to be revealed when selected.
string | RemoteFragment<RemoteRoot<any, any>>
- primaryContent
The primary content for a choice. Rendered below `<label>`.
string | RemoteFragment<RemoteRoot<any, any>>
- secondaryContent
The secondary label content for a choice in a `group` ChoiceList. Ignored in `base` [variant](/docs/api/checkout-ui-extensions/components/forms/choicelist#choicelistprops-propertydetail-value). Rendered on the opposite side to <label> and `primaryContent`.
string | RemoteFragment<RemoteRoot<any, any>>
- tertiaryContent
The tertiary label content for a choice in a `group` ChoiceList. Ignored in `base` [variant](/docs/api/checkout-ui-extensions/components/forms/choicelist#choicelistprops-propertydetail-value). Rendered below `primaryContent` and `secondaryContent`.
string | RemoteFragment<RemoteRoot<any, any>>
export interface ChoiceProps {
/**
* A unique identifier for the choice.
*/
id: string;
/**
* Whether the choice can be changed.
*/
disabled?: boolean;
/**
* A label used for buyers using assistive technologies. When set, any
* `children` supplied to this component will not be announced to screen reader users.
*/
accessibilityLabel?: string;
/**
* Additional content to be revealed when selected.
*/
details?: string | RemoteFragment;
/**
* The primary content for a choice.
* Rendered below `<label>`.
*/
primaryContent?: string | RemoteFragment;
/**
* The secondary label content for a choice in a `group` ChoiceList.
* Ignored in `base` [variant](/docs/api/checkout-ui-extensions/components/forms/choicelist#choicelistprops-propertydetail-value).
* Rendered on the opposite side to <label> and `primaryContent`.
*/
secondaryContent?: string | RemoteFragment;
/**
* The tertiary label content for a choice in a `group` ChoiceList.
* Ignored in `base` [variant](/docs/api/checkout-ui-extensions/components/forms/choicelist#choicelistprops-propertydetail-value).
* Rendered below `primaryContent` and `secondaryContent`.
*/
tertiaryContent?: string | RemoteFragment;
}
Basic Choice
examples
Basic Choice
React
import { reactExtension, Choice, ChoiceList, InlineStack, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => <Extension />, ); function Extension() { return ( <InlineStack> <ChoiceList name="ship" value="ship-1" onChange={(value) => { console.log( `onChange event with value: ${value}`, ); }} > <Choice id="ship-1">Ship</Choice> </ChoiceList> <ChoiceList name="gift" value={['gift-1']} onChange={(value) => { console.log( `onChange event with value: ${value}`, ); }} > <Choice id="multipleFirst"> Gift message </Choice> </ChoiceList> </InlineStack> ); }
JS
import { extension, ChoiceList, Choice, InlineStack, } from '@shopify/ui-extensions/checkout'; export default extension('purchase.checkout.block.render', (root) => { const choiceList = root.createComponent( ChoiceList, { name: 'ship', value: 'ship-1', onChange: (value) => { console.log(`onChange event with value: ${value}`); }, }, [root.createComponent(Choice, {id: 'ship-1'}, 'Ship')], ); const multipleChoiceList = root.createComponent( ChoiceList, { name: 'gift', value: ['gift-1'], onChange: (value) => { console.log(`onChange event with value: ${value}`); }, }, [root.createComponent(Choice, {id: 'gift-1'}, 'Gift message')], ); const layout = root.createComponent(InlineStack, undefined, [ choiceList, multipleChoiceList, ]); root.appendChild(layout); });
Preview

Anchor to best-practicesBest Practices
Include a title that either tells customers what to do or explains their available options.
Label options clearly based on what the option will do.
Avoid options that contradict each other when you’re allowing for multiple selections.