picker Component
Use the picker component to select an item from a popup list of items.
{
"type": "picker",
"items": [
{
"text": "Bananas",
"value": "fruit-bananas"
},
{
"text": "Apple",
"value": "fruit-apple"
},
{
"type": "separator"
},
{
"text": "Carrot",
"value": "vegetable-carrot"
}
]
}
Properties
- items
- ARRAY
- Of type:
OBJECT
An array of objects to add to the picker, each with the following properties:
- type
- ENUM
- Default:
"item"
The type of the item.
| Value | Description |
|---|---|
"item" |
A standard item for this picker. |
"separator" |
A separator between items. |
NoteIn general, there is no need to provide a
typeunless you want a separator. When using a separator,textandvalueare ignored.
- text
- STRING [getter]
- Recommended
The visible title of the item in the picker.
TipWhile this property is recommended, you can create a selectable empty item at the top of the popup list by omitting this property.
- selected
- STRING [getter]
- The
valueof the item
Select the item in the list by value, or get the the currently selected item.
NoteWhen getting the value from
selected, you will receive a object of thevalueandtext.
- bordershape
- ENUM
- Default:
"auto", macOS 26+
When bordered is set to true, set the shape of the border.
| Value | Description |
|---|---|
"auto" |
The shape will be determined automatically. |
"capsule" |
A capsule type border shape. |
"roundedrectangle" |
A rounded rect border shape. |
Also see Shared Properties.
Event Triggers
This component dispatches the following event triggers:
| Trigger | Description |
|---|---|
"changed" |
When the picker's selected item has changed |
Functions
Perform actions directly on this picker using the functions Action.
Examples
Speak the value of the selected item
{
"id": "speakpicker",
"type": "picker",
"items": [
{
"text": "Bananas",
"value": "fruit-bananas"
},
{
"text": "Apple",
"value": "fruit-apple"
},
{
"type": "separator"
},
{
"text": "Carrot",
"value": "vegetable-carrot"
}
],
"events": [
{
"triggers": "changed",
"action": {
"type": "json",
"variables": {
"words": "{value:speakpicker.selected.value}"
},
"src": {
"speak": {
"text": "{var:words}"
}
}
}
}
]
}