Skip to content

Commit 0afb22e

Browse files
author
Joe Pavitt
committed
Adds documentation for the ui-switch
1 parent 3ab1ecc commit 0afb22e

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed
51.3 KB
Loading

docs/nodes/widgets/ui-switch.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ props:
55
Label: The text shown within the button.
66
On Payload: The type & value to output in <code>msg.payload</code> when the switch is turned on.
77
Off Payload: The type & value to output in <code>msg.payload</code> when the switch is turned off.
8+
On Icon: If provided, this <a href="https://pictogrammers.com/library/mdi/" target="_blank">Material Design icon</a> will replace the default switch when in "on" state
9+
Off Icon: If provided, this <a href="https://pictogrammers.com/library/mdi/" target="_blank">Material Design icon</a> will replace the default switch when in "off" state
10+
On Color: If provided with a icons, this colour is used for the icon when in "on" state
11+
Off Color: If provided with a icons, this colour is used for the icon when in "off" state
812
---
913

1014
<script setup>
@@ -21,4 +25,4 @@ Adds a toggle switch to the user interface.
2125
## Example
2226

2327
![Example of a Toggle Switch](../../assets/images/node-examples/ui-switch.png "Example of a Toggle Switch"){data-zoomable}
24-
*Example of a rendered switch in a Dashboard.*
28+
*Example of rendered switches in a Dashboard.*

nodes/widgets/locales/en-US/ui_switch.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
Each change in the state of the switch will generate
77
a <code>msg.payload</code> with the specified <b>On</b> and <b>Off</b> values.
88
</p>
9-
<!-- <p>
10-
The <b>On/Off Color</b> and <b>On/Off Icon</b> are optional fields. If they are all present, the default
11-
toggle switch will be replaced with the relevant icons and their respective colors.
12-
</p> -->
13-
<!-- <p>
9+
<p>
10+
The <b>On/Off Color</b> and <b>On/Off Icon</b> are optional fields. If the icons are present, the default
11+
toggle switch will be replaced with the relevant icons and their respective colors (if defined).
12+
</p>
13+
<p>
1414
The <b>On/Off Icon</b> field can be either a <a href="https://klarsys.github.io/angular-material-icons/" target="_blank">Material Design icon</a>
1515
<i>(e.g. 'check', 'close')</i> or a <a href="https://fontawesome.com/v4.7.0/icons/" target="_blank">Font Awesome icon</a>
1616
<i>(e.g. 'fa-fire')</i>, or a <a href="https://github.com/Paul-Reed/weather-icons-lite/blob/master/css_mappings.md">Weather icon</a>.
1717
You can use the full set of google material icons if you add 'mi-' to the icon name. e.g. 'mi-videogame_asset'.
18-
</p> -->
18+
</p>
1919
<p>
2020
The switch state can be updated by an incoming <code>msg.payload</code>. The values must either be <code>true</code>/<code>false</code>
2121
or match the specified type (number, string, etc) in the node's configuration.</p>

0 commit comments

Comments
 (0)