Skip to main content

io.select.multiple

Prompts the app user to select any number of values from a set of provided values.

Usage

const condiments = await io.select.multiple("Condiments", {
options: [
{
label: "Ketchup",
value: 0,
},
{
label: "Mustard",
value: 1,
},
{
label: "Mayo",
value: 2,
},
],
defaultValue: [
{
label: "Ketchup",
value: 0,
},
{
label: "Mustard",
value: 1,
},
],
helpText: "What goes on it?",
});

const condimentIds = condiments.map(condiment => condiment.value);
interval.com

Props

defaultValue

(string | object)[] Optional

Default preselected options. Must be a subset of `options`.

label

string | number | boolean | Date Required

Display label for this particular possible option.

value

string | number | boolean | Date Required

Value for this particular possible option.

disabled

boolean Optional

Whether the input is disabled, preventing changes from the `defaultValue`.

helpText

string Optional

Secondary label providing additional context for the selection.

maxSelections

number Optional

Maximum number of selected values accepted for submission.

minSelections

number Optional

Minimum number of selected values required for submission, defaults to 0.

options

(string | number | boolean | Date | object)[] Required

Array of possible values to be selected. Can be an array of primitive values, or provide objects for more advanced customization.

label

string | number | boolean | Date Required

Display label for this particular possible option.

value

string | number | boolean | Date Required

Value for this particular possible option.

Returns

A subset of the provided options.

Examples

String options

The options property can also be an array of strings, which is equivalent to objects with identical label and value properties with the string values. Strings will be returned if this form is used.

const condimentNames = await io.select.multiple("Condiments", {
options: ["Ketchup", "Mustard", "Mayo"],
defaultValue: ["Ketchup", "Mustard"],
helpText: "What goes on it?",
});
Was this section useful?