Skip to content

CardSelect

Status: Stable

CardSelect components present a list of options for a user to choose from. The option selected influences or changes the experience. Users can select a single option from the list. This iteration deprecates the multiple prop until usability issues are resolved. Please reach out for more details.

Best practices

  • Use a balance of Radio, CardSelect, and Select to help users make choices and provide info with ease.
  • Present CardSelect options via progressive disclosure to help a user focus on the many options available.
  • Include a minimum of two options when implementing CardSelect

Examples

Default

Disabled

Props

<CardSelect>

autoFocus

boolean
Automatically give focus to the selected card, or the first card if no card is selected. This prop should be used sparingly, as it poses significant accessibility concerns for individuals using screen readers. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautofocus for more information.

className

Deprecated
string
Classes to apply to the component.

dangerouslyForceSelectedStyling

boolean
Force the component to use its selected styles.

disabled

boolean
Flag to indicate if the options should not be selectable.

name

string
Name attribute for <input> elements.

onChange

(value: Option) => void
Callback to be called when the selected value(s) change.

options

Required
Array<{ disabled?: boolean | undefined; label: ReactNode; value: Option; }>
A list of options for each individual Card.

value

NonNullable<Option>
The currently selected value.

ref

(instance: any) => void | RefObject<any>