io.select.single
Prompts the app user to select a single value from a set of provided values.
Usage
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;
interval.com
Props
defaultValue | Optional string or object | Default preselected option. Must be an item in defined options. |
helpText | Optional string | Secondary label providing additional context for the selection. |
options | Required array of strings or objects | Array of possible values to be selected. |
searchable | Optional boolean | Whether the select should support filtering options via a search box. |
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.
const currencyCode = await io.select.single("Currency", {
options: ["USD", "CAD", "EUR"],
defaultValue: "USD",
helpText: "Currency for this transaction",
});
Did this section clearly explain what you wanted to learn?