Toggle
A boolean on/off control. Stores a .bool value.
Type
"toggle"
Relevant Fields
Inherits all Control Definition. Key fields:
| Field | Type | Default | Description |
|---|---|---|---|
label |
string | — | Display label |
icon |
string | — | SF Symbol |
style |
string | "switch" |
"switch", "button", "icon-toggle" |
onIcon |
string | — | SF Symbol when on (icon-toggle style) |
offIcon |
string | — | SF Symbol when off (icon-toggle style) |
tint |
string | "#667eea" |
Accent color when on |
defaultValue |
bool | — | Initial state |
hideBackground |
bool | false |
Remove glass background |
haptic |
string | "rigid" |
Default haptic on toggle |
Styles
"switch" (default)
Standard iOS toggle switch with label above and optional icon beside.
"button"
Tap-to-toggle button. Background highlights when on with a tinted glow.
"icon-toggle"
Icon that swaps between onIcon and offIcon with a symbol transition animation.
Examples
Standard switch
{
"type": "toggle",
"id": "lr-main",
"position": [0, 0],
"label": "Main Light",
"defaultValue": true,
"action": { "method": "meshsocket", "mode": "request", "event": "route_msg", "payload": { "target_id": "hue-bridge", "type": "light", "payload": { "room": "living", "fixture": "main", "command": "{{value}}" } } },
"sync": [{ "method": "meshsocket", "type": "listen", "event": "broadcast", "filter": { "room": "living", "fixture": "main" }, "valuePath": "state" }]
}
Icon-toggle with custom icons
{
"type": "toggle",
"id": "mic-mute",
"position": [0, 0],
"label": "Mic",
"style": "icon-toggle",
"onIcon": "mic.fill",
"offIcon": "mic.slash.fill",
"tint": "#FF3B30",
"defaultValue": true
}
Conditionally visible toggle
{
"type": "toggle",
"id": "fan-oscillate",
"position": [1, 1],
"label": "Oscillate",
"defaultValue": false,
"visible": { "when": "fan-power", "operator": "eq", "value": true }
}
Related
- Control Definition — Base fields
- Toggle Styles — Style details
- Actions —
{{value}}substitution - Sync — Live state sync
- Visibility — The
visiblefield