io.select.multiple
Prompts the app user to select any number of values from a set of provided values.
Usage
- TypeScript
- JavaScript
- Python
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);
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);
condiments = await io.select.multiple("Condiments",
options=[
{
"label": "Ketchup",
"value": 0,
},
{
"label": "Mustard",
"value": 1,
},
{
"label": "Mayo",
"value": 2,
},
],
default_value=[
{
"label": "Ketchup",
"value": 0,
},
{
"label": "Mustard",
"value": 1,
},
],
help_text="What goes on it?",
)
condiment_ids = [condiment.value for condiment in condiments]
Props
- TypeScript
- JavaScript
- Python
defaultValue
Optional
(string | object)[]
label
Required
string | number | boolean | Date
value
Required
string | number | boolean | Date
disabled
Optional
boolean
helpText
Optional
string
maxSelections
Optional
number
minSelections
Optional
number
options
Required
(string | number | boolean | Date | object)[]
label
Required
string | number | boolean | Date
value
Required
string | number | boolean | Date
Returns
A subset of the provided options.
defaultValue
Optional
(string | object)[]
label
Required
string | number | boolean | Date
value
Required
string | number | boolean | Date
disabled
Optional
boolean
helpText
Optional
string
maxSelections
Optional
number
minSelections
Optional
number
options
Required
(string | number | boolean | Date | object)[]
label
Required
string | number | boolean | Date
value
Required
string | number | boolean | Date
Returns
A subset of the provided options.
default_value
Optional
Iterable[string | DefaultSelectOption]
PrimitiveValue = str | int | float | bool | date | time | datetime
class DefaultSelectOption(TypedDict):
label: PrimitiveValue
value: PrimitiveValue
disabled
Optional
bool
help_text
Optional
str
max_selections
Optional
int
min_selections
Optional
int
options
Optional
Iterable[PrimitiveValue | SelectOption]
PrimitiveValue = str | int | float | bool | date | time | datetime
class ImageSchema(TypedDict):
url: NotRequired[str]
alt: NotRequired[str]
size: NotRequired[Literal["thumbnail", "small", "medium", "large"]]
class SelectOption(TypedDict):
label: PrimitiveValue
value: PrimitiveValue
description: NotRequired[str]
image: NotRequired[ImageSchema]
Returns
List of the selected 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.
- TypeScript
- JavaScript
- Python
const condimentNames = await io.select.multiple("Condiments", {
options: ["Ketchup", "Mustard", "Mayo"],
defaultValue: ["Ketchup", "Mustard"],
helpText: "What goes on it?",
});
const condimentNames = await io.select.multiple("Condiments", {
options: ["Ketchup", "Mustard", "Mayo"],
defaultValue: ["Ketchup", "Mustard"],
helpText: "What goes on it?",
});
condiment_names = await io.select.multiple(
"Condiments",
options=["Ketchup", "Mustard", "Mayo"],
default_value=["Ketchup", "Mustard"],
help_text="What goes on it?",
)