<switch>
A Material on/off toggle with an optional label; name= holds true or false.
<column style="w-full gap-8">
<switch name="wifi"
label="Wi-Fi"
checked="true"
color="teal-600"/>
<switch name="bluetooth"
label="Bluetooth"
color="teal-600"/>
<text @text="$wifi ? 'Connected to Home_5G' : 'Wi-Fi is off'"
style="muted"></text>
</column>
Attributes
| Name | What it does | Default |
|---|---|---|
checked |
Initial toggle state boolean |
false |
color |
Active color color |
|
label |
Toggle label string |
|
name |
Variable name for form scoping string |
Readings
| Name | What it does |
|---|---|
checked |
The same as value, named after checked=. |
value |
Whether it is on, live. |
Any tag also takes gestures: @on.tap, @on.longpress, @on.doubletap and @on.swipeleft (and right, up and down). @click runs on a tap too.