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.
Note

In general, there is no need to provide a type unless you want a separator. When using a separator, text and value are ignored.

text
STRING [getter]
Recommended

The visible title of the item in the picker.

Tip

While this property is recommended, you can create a selectable empty item at the top of the popup list by omitting this property.

value
STRING [getter]
Unique

The underlying value of this item when selected.

selected
STRING [getter]
The value of the item

Select the item in the list by value, or get the the currently selected item.

Note

When getting the value from selected, you will receive a object of the value and text.

font
FONT | null
null sets the default font

The FONT for this picker's text.

bordered
BOOL
Default: true

Set if this button has a border or not.

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.

selectfirst

Select the first item in the picker.

selectlast

Select the last item in the picker.

selectprevious

Select the previous item in the picker.

selectnext

Select the next item in the picker.

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}"
          }
        }
      }
    }
  ]
}