Toggle
Represents an on/off value with a native switch or checkbox.
<Toggle ... />
Overview
This component is backed by the platform control or container. Prefer its XML tag in an .etlua template; keep view-tree construction out of controllers.
Topics
Properties
| Name | Type | Required | Description |
|---|---|---|---|
action |
function | optional | Component-specific setting passed to the native control. |
disabled |
boolean | optional | Component-specific setting passed to the native control. |
is_on |
value | optional | Current on/off value (legacy spelling). |
label |
value | optional | Component-specific setting passed to the native control. |
tint |
string | optional | Semantic color of the checked state, SwiftUI .tint. |
style |
string | optional | switch, or button for a push-on/push-off button that fills while on (SwiftUI .toggleStyle(.button)). |
systemImage |
string | optional | SF Symbol shown above a button style label. |
symbolSize |
number | optional | SF Symbol point size; defaults to the label font. |
Example
<Toggle />
Platform notes
- AppKit uses the AppKit implementation. UIKit uses the UIKit implementation.
Source: lua/embedded/AppKit.lua:1814 (AppKit.Toggle)