# Create UI switches dynamically

**URL:** https://discourse.nodered.org/t/create-ui-switches-dynamically/40378
**Category:** Dashboard
**Created:** [4 February 2021 13:40 UTC](https://discourse.nodered.org/t/create-ui-switches-dynamically/40378 "2021-02-04T13:40:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)
#### Post date: [4 February 2021 13:40 UTC](https://discourse.nodered.org/t/create-ui-switches-dynamically/40378/1 "2021-02-04T13:40:24Z")

</div>

I have a list of devices (id and name) to show as switches in the dashboard. Can I create the switches dynamically, from a function, so that I don't have to build each of them in the flow manually?

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [4 February 2021 14:55 UTC](https://discourse.nodered.org/t/create-ui-switches-dynamically/40378/2 "2021-02-04T14:55:45Z")

</div>

Only if you build your own in a ui-template

---

<div class="post-metadata">

### Author: ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)
#### Post date: [4 February 2021 15:10 UTC](https://discourse.nodered.org/t/create-ui-switches-dynamically/40378/3 "2021-02-04T15:10:25Z")

</div>

Do you mean by using Angular code?

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [4 February 2021 17:29 UTC](https://discourse.nodered.org/t/create-ui-switches-dynamically/40378/4 "2021-02-04T17:29:00Z")

</div>

yes - eg see previous thread [Dynamically create dashboard items](https://discourse.nodered.org/t/dynamically-create-dashboard-items/13841)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [18 February 2021 17:29 UTC](https://discourse.nodered.org/t/create-ui-switches-dynamically/40378/5 "2021-02-18T17:29:15Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
