Skip to main content

MultipleChoice

@shopify/shop-minis-platform-sdk / components/MultipleChoice/MultipleChoice

ChoiceType\<T>

Type Parameters

Type ParameterDefault type
T extends string | numberstring | number

Properties

disabled?

optional disabled: boolean

If true, the choice will not be clickable and will be greyed out

label

label: string

The text displayed in the choice

value

value: T

The value that is returned when clicked on the choice


MultipleChoiceProps\<T>

Type Parameters

Type ParameterDefault type
T extends string | numberstring | number

Properties

animated?

optional animated: boolean

choices

choices: ChoiceType\<T>[]

An array of options to be selected by the user

Example
const choices = [{label: 'choice 1', value: 'value 1'}]
<MultipleChoice {...} choices={choices} />

onChoiceSelected()

onChoiceSelected: (index, value) => void

An function to call when a choice is pressed

Parameters
ParameterType
indexnumber
valueT
Returns

void

Example
<MultipleChoice {...} onChoiceSelected={(index, value) => console.log({index, value})} />

selectedIndexes

selectedIndexes: number[]

An array of indexes that should be displayed as selected

Example
<MultipleChoice {...} selectedIndexes={[0,1]} />

This example will select the first and second choice

style?

optional style: MultipleChoiceStyles


MultipleChoiceStyles

Properties

selectedTextStyle

selectedTextStyle: TextStyle & TextStyle

textStyle

textStyle: TextStyle

toggleButtonSelectedStyle

toggleButtonSelectedStyle: BoxStyle

toggleButtonStyle

toggleButtonStyle: BoxStyle


MultipleChoice()

MultipleChoice(__namedParameters): Element

Parameters

ParameterType
__namedParametersMultipleChoiceProps\<string | number>

Returns

Element