# Can you change tabs by clicking something within a page

**URL:** <https://discourse.nodered.org/t/can-you-change-tabs-by-clicking-something-within-a-page/63329>\
**Category:** General\
**Created:** [31 May 2022 21:27 UTC](https://discourse.nodered.org/t/can-you-change-tabs-by-clicking-something-within-a-page/63329 "2022-05-31T21:27:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![k5map](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/k5map/32/47681_2.png) [@k5map](https://discourse.nodered.org/u/k5map)\
**Post date:** [31 May 2022 21:27 UTC](https://discourse.nodered.org/t/can-you-change-tabs-by-clicking-something-within-a-page/63329/1 "2022-05-31T21:27:41Z")

</div>

I've looked but haven't been able to find a way to add a component (aka button) to a page so when you click it, it switches to one of the other pages/tabs. Does this capability exist within NR?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [31 May 2022 21:31 UTC](https://discourse.nodered.org/t/can-you-change-tabs-by-clicking-something-within-a-page/63329/2 "2022-05-31T21:31:38Z")

</div>

Hi @k5map

Just to clarify, is this with the `node-red-dashboard` set of nodes? If not, can you say a bit more about what page you want to add a button to?

---

<div class="post-metadata">

**Author:** ![k5map](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/k5map/32/47681_2.png) [@k5map](https://discourse.nodered.org/u/k5map)\
**Post date:** [31 May 2022 21:32 UTC](https://discourse.nodered.org/t/can-you-change-tabs-by-clicking-something-within-a-page/63329/3 "2022-05-31T21:32:41Z")

</div>

@knolleary ... my bad for not clarifying... Yes, I was asking about this capability within the dashboard.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [31 May 2022 21:36 UTC](https://discourse.nodered.org/t/can-you-change-tabs-by-clicking-something-within-a-page/63329/4 "2022-05-31T21:36:53Z")

</div>

I don't have an example I can immediately share, but I can give you a couple pointers.

The dashboard provides the `ui control` node. This is a node that can be used to change which tab is being shown by the dashboard (amongst other things).

From the help for the node:

> The default function is to change the currently displayed tab. `msg.payload` should either be an object of the form `{"tab":"my_tab_name"}` , or just be the **tab name** or **numeric index** (from 0) of the tab or link to be displayed.

So, with that information, you could create a flow that is:

```auto
[ui button] -> [Change] -> [ui control]

```

The Button node triggers the Change node which sets `msg.payload` to the appropriate value to pass to the control node to change the tab.

Does that make sense?

---

<div class="post-metadata">

**Author:** ![k5map](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/k5map/32/47681_2.png) [@k5map](https://discourse.nodered.org/u/k5map)\
**Post date:** [31 May 2022 21:48 UTC](https://discourse.nodered.org/t/can-you-change-tabs-by-clicking-something-within-a-page/63329/5 "2022-05-31T21:48:04Z")

</div>

It does... I'll see if I can get it working using your example. Much thanks

---

<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:** [14 June 2022 21:48 UTC](https://discourse.nodered.org/t/can-you-change-tabs-by-clicking-something-within-a-page/63329/6 "2022-06-14T21:48:20Z")

</div>

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