# A component for Conditional UI elements?

**URL:** https://meta.discourse.org/t/a-component-for-conditional-ui-elements/110255
**Category:** Development
**Created:** [February 27, 2019, 5:19pm UTC](https://meta.discourse.org/t/a-component-for-conditional-ui-elements/110255 "2019-02-27T17:19:18Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![swamidass](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/swamidass/32/119549_2.png) [@swamidass](https://meta.discourse.org/u/swamidass)
#### Post date: [February 27, 2019, 5:19pm UTC](https://meta.discourse.org/t/a-component-for-conditional-ui-elements/110255/1 "2019-02-27T17:19:18Z")

</div>

Is there a theme component to add buttons, css, or links based on conditions?

I want to add a button were users can request memebership if they don’t have it yet in certain categories.

---

<div class="post-metadata">

### Author: ![elbarto](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elbarto/32/220286_2.png) [@elbarto](https://meta.discourse.org/u/elbarto)
#### Post date: [May 19, 2021, 12:11am UTC](https://meta.discourse.org/t/a-component-for-conditional-ui-elements/110255/2 "2021-05-19T00:11:09Z")

</div>

Hi Joshua, have an answer for that question? I have the same problem

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [May 19, 2021, 12:22am UTC](https://meta.discourse.org/t/a-component-for-conditional-ui-elements/110255/3 "2021-05-19T00:22:41Z")

</div>

You can look up `currentUser` throughout most of the application and use its properties to create your condition. Can you share more details about what you’re trying to achieve?

---

<div class="post-metadata">

### Author: ![elbarto](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elbarto/32/220286_2.png) [@elbarto](https://meta.discourse.org/u/elbarto)
#### Post date: [May 19, 2021, 12:36am UTC](https://meta.discourse.org/t/a-component-for-conditional-ui-elements/110255/4 "2021-05-19T00:36:20Z")

</div>

Thanks @Johani ! I try to show some elements only in the homepage. I need to verify if this page is the homepage and then show it

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [May 19, 2021, 1:29am UTC](https://meta.discourse.org/t/a-component-for-conditional-ui-elements/110255/5 "2021-05-19T01:29:17Z")

</div>

Is your element a banner or something similar to that that shows at the top of the homepage?

Can you share a screenshot of what it looks like?

---

<div class="post-metadata">

### Author: ![elbarto](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elbarto/32/220286_2.png) [@elbarto](https://meta.discourse.org/u/elbarto)
#### Post date: [May 19, 2021, 1:52am UTC](https://meta.discourse.org/t/a-component-for-conditional-ui-elements/110255/6 "2021-05-19T01:52:10Z")

</div>

In general i have some elements that i need to show in homepage, like a any web page have a video demo, welcome text, suscribe form, pictures.  
Theese content i dont need to show in my other sections (eg categories, threads, etc), because there are in the home page only.  
I tryed to make this effect with JS but when i save my code on the “after header” that doesnt run scripts. Only run in “\</ body\>” and “\</ hader\>” elements and its impossible to change the order in the html.  
For example, if i try to make this structure, its impossible:

- header
- search
- video (only in the home)
- threads
- recomendations (only in home)
- footer

I think that Discourse use a normal webpage in a home path domain and then use the forums in a subdomain, but it would be great to be able to customize content blocks according to the page, and use only Discourse for the entire site.

Sorry about my english 😅 and thanks for your answer!
