# Trigger a component action globally

**URL:** <https://community.weweb.io/t/trigger-a-component-action-globally/17281>\
**Category:** How do I?\
**Created:** [March 18, 2025, 11:21pm UTC](https://community.weweb.io/t/trigger-a-component-action-globally/17281 "2025-03-18T23:21:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cajo](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@Cajo](https://community.weweb.io/u/Cajo)\
**Post date:** [March 18, 2025, 11:21pm UTC](https://community.weweb.io/t/trigger-a-component-action-globally/17281/1 "2025-03-18T23:21:16Z")

</div>

We have a component (“Alert”) which is added to all pages for the purpose of displaying errors/alerts/notifications.

What I wanted to do is create a global workflow that will trigger the Alert component’s (on the current page) workflow (mainly for setting it’s message and displaying it). Being able to do this via a Global workflow would be convenient so that we do not have to recreate references to the Alert component instance on the page each time we will use it.

Currently I believe this is not possible since each instance of the Alert component has a different ID on each page, but I’m probably wrong.

Is there a way to do this?

---

<div class="post-metadata">

**Author:** ![archenia\_jsanchez](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/archenia_jsanchez/32/8656_2.png) [@archenia\_jsanchez](https://community.weweb.io/u/archenia_jsanchez)\
**Post date:** [March 19, 2025, 8:04pm UTC](https://community.weweb.io/t/trigger-a-component-action-globally/17281/2 "2025-03-19T20:04:52Z")

</div>

Spitballing here. I haven’t tested this so this is in theory.

1. add properties to your alert component, eg “show”, “title”, and “message”.
2. include the component in each page
3. set a global variable, eg `alert` that stores the properties, eg `{show:true, title: "Alert", message:"Lorem ipsum"}` and bind each instance of the alert to that variable.
4. update the global variable via the global workflow and all alert instances should pull the update from the global variable.

---

<div class="post-metadata">

**Author:** ![wealthsyndy](https://avatars.discourse-cdn.com/v4/letter/w/48db29/32.png) [@wealthsyndy](https://community.weweb.io/u/wealthsyndy)\
**Post date:** [March 19, 2025, 8:22pm UTC](https://community.weweb.io/t/trigger-a-component-action-globally/17281/3 "2025-03-19T20:22:27Z")

</div>

Include the component into a section and then include that section on each page as a multi page section. This is what I did for the Alert, as well as a bunch of different modals.

---

<div class="post-metadata">

**Author:** ![Cajo](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@Cajo](https://community.weweb.io/u/Cajo)\
**Post date:** [March 19, 2025, 10:51pm UTC](https://community.weweb.io/t/trigger-a-component-action-globally/17281/4 "2025-03-19T22:51:25Z")

</div>

@archenia_jsanchez Thanks forgetting back. That’s a great approach, haven’t thought of that. Will try it out.

---

<div class="post-metadata">

**Author:** ![Cajo](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@Cajo](https://community.weweb.io/u/Cajo)\
**Post date:** [March 19, 2025, 10:53pm UTC](https://community.weweb.io/t/trigger-a-component-action-globally/17281/5 "2025-03-19T22:53:28Z")

</div>

Thank you! I haven’t tried using multipage sections before (frankly, I didn’t know they existed). Will give this a shot.

---

<div class="post-metadata">

**Author:** ![Cajo](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@Cajo](https://community.weweb.io/u/Cajo)\
**Post date:** [March 19, 2025, 11:39pm UTC](https://community.weweb.io/t/trigger-a-component-action-globally/17281/6 "2025-03-19T23:39:29Z")

</div>

@wealthsyndy This did the trick, I can reference the same component instance across pages. The multi page section is awesome and will enable me to do other cool things. Thanks!

---

<div class="post-metadata">

**Author:** ![wealthsyndy](https://avatars.discourse-cdn.com/v4/letter/w/48db29/32.png) [@wealthsyndy](https://community.weweb.io/u/wealthsyndy)\
**Post date:** [March 20, 2025, 12:22am UTC](https://community.weweb.io/t/trigger-a-component-action-globally/17281/7 "2025-03-20T00:22:11Z")

</div>

Yes I use it for modals, navigation, alerts .. so far…
