Guide / Controls / Reference

Long Press

3D-Touch-style sub-group popups.

Symbol
hand.tap.fill
Docs
Docs complete

Fields

2 fields, each with what it does.

Fields
FieldTypeDefaultWhat it does
longPressActionlongPressActionaction—

What happens when you hold

Runs this action when the control is held down, with no popup.

longPressGrouplongPressGroupobject—

A pop-up menu on hold

Opens a frosted popup of child controls from the control when it is held down.

Examples

3 examples, each one a control you can paste into a layout.

Quick actions popup

Demonstrates longPressGroup: holding the button opens a frosted two-button popup.

JSON 11 lines
{
  "type": "button", "id": "lights", "position": [0, 0], "label": "Lights",
  "longPressGroup": {
    "id": "lights-menu", "label": "Lights",
    "grid": { "columns": 2, "rows": 1 },
    "children": [
      { "type": "button", "id": "all-on", "position": [0, 0], "label": "All on" },
      { "type": "button", "id": "all-off", "position": [1, 0], "label": "All off" }
    ]
  }
}

Open in CAR-TER

Hold to fire an action

Demonstrates longPressAction: holding runs the action directly, with no popup.

JSON 17 lines
{
  "type": "button",
  "id": "panic",
  "position": [
    0,
    0
  ],
  "label": "Alarm",
  "longPressAction": {
    "method": "meshsocket",
    "mode": "broadcast",
    "event": "broadcast_request",
    "payload": {
      "msg_type": "alarm"
    }
  }
}

Open in CAR-TER

Hold on a toggle

Demonstrates longPressAction on a non-button host: the toggle flips on tap and the hold runs a separate action.

JSON 17 lines
{
  "type": "toggle",
  "id": "fan",
  "position": [
    0,
    0
  ],
  "label": "Fan",
  "longPressAction": {
    "method": "meshsocket",
    "mode": "broadcast",
    "event": "broadcast_request",
    "payload": {
      "msg_type": "fan_boost"
    }
  }
}

Open in CAR-TER

Sub-Group

"longPressGroup": {
  "id": "menu",
  "label": "Quick Actions",
  "grid": { "columns": 3, "rows": 2 },
  "children": [ ... ]
}

Features

  • Frosted blur background
  • Bouncy spring from source
  • Dismiss: tap outside / swipe down
  • Haptics: medium on open

Action Only

"longPressAction": { ... }

Fires without popup. See Toggle expand.

Generated from ControlDocs/long-press.md. Something unclear or missing? Tell me.