ChoiceGroup
A list of options a member picks from before moving on, as radios, checkboxes or links. Use when the choice fills the screen rather than sitting in a form.
compliant
- Overview
- Props
Use ChoiceGroup when users need to choose between multiple items before navigating to another screen or completing an action. Common use cases include:
- Selecting a care act from a list before viewing details
- Choosing a care type before entering the claim reimbursement flow
- Picking a plan or option before proceeding to checkout
Don't use ChoiceGroup for a single button or link. Use a ListItem or HighlightButton instead.
Quickstart
Props
Variants
Visual style variant:
Rich Variant
"rich": Detailed UI with icons, descriptions, and custom children. Use for detailed option lists.
Selected: none
Simple Variant
"simple": Minimal design with label-only items. Use for basic selection needs.
Selected: none
Decor Types
The decor prop allows adding visual elements to items. Supported types:
icon: Display an icon (e.g.,{ type: "icon", visual: "Flag" })emoji: Display an emoji (e.g.,{ type: "emoji", visual: "👋" })avatar: Display an avatar withimageURLorimage(e.g.,{ type: "avatar", imageURL: "..." })blobby: Display a blobby illustration (e.g.,{ type: "blobby", visual: "blobby", color: "indigo" })
Selected: none
Type
Behavior type:
"single": Radio buttons - only one option can be selected at a time."multiple": Checkboxes - multiple options can be selected simultaneously."action": Button or link actions (non-selection). Items requirevariant="button"orvariant="link".
Single
Selected: none
Multiple
Selected: none
Action
Examples
Preselected Values
Initialize state with a value to preselect options:
Selected: option2
Disabled Items
Individual items can be disabled:
Selected: option1
Option 2 (disabled)
This option is disabled
Custom Gap
Customize spacing between items using the gap prop:
Selected: none
Mixed Buttons and Links
Mix button and link items in action type:
Accessibility
ChoiceGroup requires either an aria-label or aria-labelledby prop for type="single" and type="multiple". These props are not required for type="action" since action items are individual buttons/links that don't form a selection group.
Playground
murray and murray/mobile.ChoiceGroup props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| aria-label | stringundefined | Accessibility label for the group | ||
| aria-labelledby | stringundefined | ID of element that labels the group | ||
| children* | ReactNode | Child ChoiceGroup.Item components | ||
| defaultValue | stringstring[]undefined | Selected item value (uncontrolled) Array of selected item values (uncontrolled) | ||
| gap | ChoiceGroupGapundefined | Gap between items (defaults to $px12) | ||
| onChange | 2 possibilities((value: string) => void) | ((value: string[]) => void)undefined | Callback when selection changes | ||
| sx | PositionPropsundefined | Positioning styles for the group | ||
| type* | "action""multiple""single" | Selection type: "single" for radio buttons Selection type: "multiple" for checkboxes Action type: "action" for button/link actions (non-selection) | ||
| value | stringstring[]undefined | Selected item value (controlled) Array of selected item values (controlled) | ||
| variant* | "rich""simple" | Visual variant: "rich" for detailed UI, "simple" for minimal UI |
ChoiceGroup.Item props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| aria-hidden | booleanundefined |
Undocumented props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| decor | any | |||
| decorAlignment | any | |||
| description | any | |||
| disabled | any | |||
| hideCaret | any | |||
| href | any | |||
| label | any | |||
| onPress | any | |||
| progress | any | |||
| sx | any | |||
| testID | any | |||
| value | any | |||
| variant | any |
Style API
Use sx for one-off adjustments. It accepts these style keys:
Each can be overridden per breakpoint with: