io.select.single
Prompts the app user to select a single value from a set of provided values.
Usage
- TypeScript
- JavaScript
- Python Experimental
const currency = await io.select.single("Currency", {
options: [
{
label: "US Dollar",
value: "USD",
},
{
label: "Canadian Dollar",
value: "CAD",
},
{
label: "Euro",
value: "EUR",
},
],
defaultValue: "USD",
helpText: "Currency for this transaction",
});
const currencyCode = currency.value;
const currency = await io.select.single("Currency", {
options: [
{
label: "US Dollar",
value: "USD",
},
{
label: "Canadian Dollar",
value: "CAD",
},
{
label: "Euro",
value: "EUR",
},
],
defaultValue: "USD",
helpText: "Currency for this transaction",
});
const currencyCode = currency.value;
currency = await io.select.single(
"Currency",
options=[
{
"label": "US Dollar",
"value": "USD",
},
{
"label": "Canadian Dollar",
"value": "CAD",
},
{
"label": "Euro",
"value": "EUR",
},
],
default_value="USD",
help_text="Currency for this transaction",
)
Props
- TypeScript
- JavaScript
- Python Experimental
defaultValue
Optional
string | number | boolean | Date | object
disabled
Optional
boolean
helpText
Optional
string
options
Required
(string | number | boolean | Date | object)[]
description
Optional
string
image
Optional
object
{
// a URL to the image
url?: string
// the image alt tag
alt?: string
// the size of the image
size?: "thumbnail" | "small" | "medium" | "large"
}
imageUrl
Optional
string
label
Required
string | number | boolean | Date
value
Required
string | number | boolean | Date
searchable
Optional
boolean
Returns
The selected option.
defaultValue
Optional
string | number | boolean | Date | object
disabled
Optional
boolean
helpText
Optional
string
options
Required
(string | number | boolean | Date | object)[]
description
Optional
string
image
Optional
object
{
// a URL to the image
url?: string
// the image alt tag
alt?: string
// the size of the image
size?: "thumbnail" | "small" | "medium" | "large"
}
imageUrl
Optional
string
label
Required
string | number | boolean | Date
value
Required
string | number | boolean | Date
searchable
Optional
boolean
Returns
The selected option.
default_value
Optional
str | DefaultSelectOption
PrimitiveValue = str | int | float | bool | date | time | datetime
class DefaultSelectOption(TypedDict):
label: PrimitiveValue
value: PrimitiveValue
disabled
Optional
bool
help_text
Optional
str
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]
searchable
Optional
bool
Returns
The selected option
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.
A string will be returned if this form is used.
- TypeScript
- JavaScript
- Python Experimental
const currencyCode = await io.select.single("Currency", {
options: ["USD", "CAD", "EUR"],
defaultValue: "USD",
helpText: "Currency for this transaction",
});
const currencyCode = await io.select.single("Currency", {
options: ["USD", "CAD", "EUR"],
defaultValue: "USD",
helpText: "Currency for this transaction",
});
currency_code = await io.select.single(
"Currency",
options=["USD", "CAD", "EUR"]
default_value="USD",
help_text="Currency for this transaction",
)