--- title: ChoiceList description: >- Present multiple options to users, allowing either single selections with radio buttons or multiple selections with checkboxes. api_name: app-home source_url: html: >- https://shopify.dev/docs/api/app-home/polaris-web-components/forms/choicelist md: >- https://shopify.dev/docs/api/app-home/polaris-web-components/forms/choicelist.md --- # Choice​List Present multiple options to users, allowing either single selections with radio buttons or multiple selections with checkboxes. ## Properties * details 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. * disabled boolean Default: false Disables the field, disallowing any interaction. `disabled` on any child choices is ignored when this is true. * error 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. * label string Content to use as the field label. * 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. * multiple boolean Default: false Whether multiple choices can be selected. * name string An identifier for the field that is unique within the nearest containing form. * values string\[] An array of the `value`s of the selected options. This is a convenience prop for setting the `selected` prop on child options. ## Events Learn more about [registering events](https://shopify.dev/docs/api/app-home/using-polaris-components#event-handling). * change CallbackEventListener\ | null * input CallbackEventListener\ | null ### CallbackEventListener ```ts (EventListener & { (event: CallbackEvent): void; }) | null ``` ### CallbackEvent ```ts Event & { currentTarget: HTMLElementTagNameMap[T]; } ``` ## Choice Create options that let users select one or multiple items from a list of choices. * accessibilityLabel string A label used for users using assistive technologies like screen readers. When set, any children or `label` supplied will not be announced. This can also be used to display a control without a visual label, while still providing context to users using screen readers. * defaultSelected boolean Default: false Whether the control is active by default. * disabled boolean Default: false Disables the control, disallowing any interaction. * selected boolean Default: false Whether the control is active. * value string The value used in form data when the control is checked. ## Slots * children HTMLElement Content to use as the choice label. The label is produced by extracting and concatenating the text nodes from the provided content; any markup or element structure is ignored. * details HTMLElement Additional text to provide context or guidance for the input. This text is displayed along with the input and its label to offer more information or instructions to the user. ### Examples * #### Code ##### jsx ```jsx const handleChange = (event) => { console.log('Values: ', event.currentTarget.values) } return ( Hidden Optional Required ) ``` ##### html ```html Hidden Optional Required ``` ## Examples Component examples ### Basic usage Basic usage Demonstrates a basic ChoiceList with single selection, showing how to create a group of radio button choices. Multiple selections Illustrates a ChoiceList with multiple selection enabled, allowing users to choose multiple options with additional descriptive details for each choice. With error state Shows how to display an error message in a ChoiceList when an invalid selection is made or a validation constraint is not met. Multiple choices with details Showcases a multiple-selection ChoiceList with each option including detailed information. ### Examples * #### Basic usage ##### Description Demonstrates a basic ChoiceList with single selection, showing how to create a group of radio button choices. ##### jsx ```jsx Hidden Optional Required ``` ##### html ```html Hidden Optional Required ``` * #### Multiple selections ##### Description Illustrates a ChoiceList with multiple selection enabled, allowing users to choose multiple options with additional descriptive details for each choice. ##### jsx ```jsx Use the shipping address as the billing address by default Reduces the number of fields required to check out. The billing address can still be edited. Require a confirmation step Customers must review their order details before purchasing. ``` ##### html ```html Use the shipping address as the billing address by default Reduces the number of fields required to check out. The billing address can still be edited. Require a confirmation step Customers must review their order details before purchasing. ``` * #### With error state ##### Description Shows how to display an error message in a ChoiceList when an invalid selection is made or a validation constraint is not met. ##### jsx ```jsx Hidden Optional Required ``` ##### html ```html Hidden Optional Required ``` * #### Multiple choices with details ##### Description Showcases a multiple-selection ChoiceList with each option including detailed information. ##### jsx ```jsx Standard shipping 5-7 business days delivery Express shipping 2-3 business days delivery Overnight shipping Next business day delivery ``` ##### html ```html Standard shipping 5-7 business days delivery Express shipping 2-3 business days delivery Overnight shipping Next business day delivery ``` ### Form validation Choice list validation Interactive example showing required choice validation with dynamic error messages. ### Examples * #### Choice list validation ##### Description Interactive example showing required choice validation with dynamic error messages. ##### jsx ```jsx const [error, setError] = useState('Please select at least one option'); return ( { setError(e.currentTarget.values.length > 0 ? '' : 'Please select at least one option'); }} > Hidden Optional Required ) ```