# Babylon GUI Responsive Top Menu

**URL:** <https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791>\
**Category:** Questions\
**Created:** [January 15, 2022, 10:59pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791 "2022-01-15T22:59:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [January 15, 2022, 10:59pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/1 "2022-01-15T22:59:55Z")

</div>

Does anybody have some examples of responsive Babylon GUI interfaces like Navbar - [Navbar · Bootstrap v5.0](https://getbootstrap.com/docs/5.0/components/navbar/) ?

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [January 17, 2022, 12:02pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/2 "2022-01-17T12:02:37Z")

</div>

@msDestiny14 which is our GUI queen is on vacation for now, but I’ll ping her to check this out when she comes back!  
The general suggestion from the questions I’ve searched seems to be going for “%” values.

These are some I’ve found, hopefully they help somehow:  
[GUI image scaling - Questions - Babylon.js (babylonjs.com)](https://forum.babylonjs.com/t/gui-image-scaling/1662/9)  
[Not sure how to support different screen resolutions with GUI - Questions - Babylon.js (babylonjs.com)](https://forum.babylonjs.com/t/not-sure-how-to-support-different-screen-resolutions-with-gui/965)  
[How to make everything in an advanced dynamic texture responsive to the window height and width? - Questions - Babylon.js (babylonjs.com)](https://forum.babylonjs.com/t/how-to-make-everything-in-an-advanced-dynamic-texture-responsive-to-the-window-height-and-width/24238/2)

---

<div class="post-metadata">

**Author:** ![msDestiny14](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/msdestiny14/32/9572_2.png) [@msDestiny14](https://forum.babylonjs.com/u/msDestiny14)\
**Post date:** [January 24, 2022, 6:19pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/3 "2022-01-24T18:19:39Z")

</div>

Hi @labris I’m back from vacation! This is a really cool idea and I’m going to try to implement a demo like this for you. 🙂

Stay tuned 😉

---

<div class="post-metadata">

**Author:** ![msDestiny14](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/msdestiny14/32/9572_2.png) [@msDestiny14](https://forum.babylonjs.com/u/msDestiny14)\
**Post date:** [January 24, 2022, 6:19pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/4 "2022-01-24T18:19:42Z")

</div>

Assigned @msDestiny14 on January 24, 2022, 6:19pm UTC



---

<div class="post-metadata">

**Author:** ![jeremy-coleman](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jeremy-coleman/32/15493_2.png) [@jeremy-coleman](https://forum.babylonjs.com/u/jeremy-coleman)\
**Post date:** [January 24, 2022, 7:06pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/5 "2022-01-24T19:06:40Z")

</div>

this is pretty fancy

> **[Babylon.js Playground](https://playground.babylonjs.com/#PWS096%237)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![msDestiny14](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/msdestiny14/32/9572_2.png) [@msDestiny14](https://forum.babylonjs.com/u/msDestiny14)\
**Post date:** [January 24, 2022, 9:47pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/6 "2022-01-24T21:47:16Z")

</div>

Wow this is really cool!

Here’s is the start of the demo I am working on, all done using our awesome GUI Editor! 😊

[https://gui.babylonjs.com/#T9MZM2#5](https://gui.babylonjs.com/#T9MZM2#5)

In the editor layout I linked, you can see I’m creating lots of grids inside grids 😉 Also, notice how I am using a combination of both px and % when it comes to sizing (I tested it on the different sample responsive sizes just to get a feel).

I’m going to now go work on implementing some functionality to this. There are actually for now two ways to do this. Either I can create separate layouts and then call load on each one. Or have all the elements visible on one layout and then hide/show them using code. Probably will go with the latter implementation for this.

---

<div class="post-metadata">

**Author:** ![jeremy-coleman](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jeremy-coleman/32/15493_2.png) [@jeremy-coleman](https://forum.babylonjs.com/u/jeremy-coleman)\
**Post date:** [January 25, 2022, 7:51am UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/7 "2022-01-25T07:51:30Z")

</div>

I have been curious about this for a while. Is the purpose of babylon gui to be svg or gl/wgl context only so it can render outside of the browser?

---

<div class="post-metadata">

**Author:** ![msDestiny14](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/msdestiny14/32/9572_2.png) [@msDestiny14](https://forum.babylonjs.com/u/msDestiny14)\
**Post date:** [January 25, 2022, 3:39pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/8 "2022-01-25T15:39:02Z")

</div>

> **[Babylon.js Playground](https://playground.babylonjs.com/#4RTUCB%2364)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

Here is the implementation side of the above-posted layout. (This was really fun to make as well btw)

This could go on and on and there are tons of ways to expand on this or even make it more generic. But here is an in-depth summary of how we did it:

1. Load in the advancedTexture using parseFromSnippetAsync (lines 30-31)

2. Find specifically the Features button and the drop-down rectangle, so we can program the drop-down on click. (lines 34-41)

3. Get all the text buttons and use onPointerEnterObservable and onPointerOutObservable to program different effects for hover feedback. (lines 43 - 64)

4. Repeat the same step except with the feature drop down buttons (lines 60-79)

5. Finally we implement the search bar (lines 82-87)

```auto
    searchButton.onPointerClickObservable.add( () => {  
        alert("Now leaving playground");
        window.location.href = 'https://doc.babylonjs.com/search?q=' + searchBar.text;
    });

```

Let me know if anyone has any questions about this. 🙂

@jeremy-coleman as for your question let me find more about that. One purpose I can tell you about BJS GUI is the unique ability to be able to project onto a 3D mesh and can even get buttons and input to work on it pretty easily. [https://playground.babylonjs.com/#H896c7#13](https://playground.babylonjs.com/#H896c7#13).

---

<div class="post-metadata">

**Author:** ![jeremy-coleman](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jeremy-coleman/32/15493_2.png) [@jeremy-coleman](https://forum.babylonjs.com/u/jeremy-coleman)\
**Post date:** [January 25, 2022, 3:48pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/9 "2022-01-25T15:48:35Z")

</div>

I love that example.

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [January 25, 2022, 4:05pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/10 "2022-01-25T16:05:21Z")

</div>

And even the search function is working - it is real miracle!

---

<div class="post-metadata">

**Author:** ![msDestiny14](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/msdestiny14/32/9572_2.png) [@msDestiny14](https://forum.babylonjs.com/u/msDestiny14)\
**Post date:** [January 25, 2022, 4:52pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/11 "2022-01-25T16:52:06Z")

</div>

Unassigned @msDestiny14 on January 25, 2022, 4:52pm UTC



---

<div class="post-metadata">

**Author:** ![bjsuser](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bjsuser/32/25577_2.png) [@bjsuser](https://forum.babylonjs.com/u/bjsuser)\
**Post date:** [October 2, 2022, 5:24am UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/12 "2022-10-02T05:24:28Z")

</div>

Thanks for taking the time and sharing @msDestiny14. Tied in with a hamburger menu version for mobile phone and we are off to the races.

---

<div class="post-metadata">

**Author:** ![pdotpup](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pdotpup/32/37958_2.png) [@pdotpup](https://forum.babylonjs.com/u/pdotpup)\
**Post date:** [September 4, 2023, 3:45pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/13 "2023-09-04T15:45:15Z")

</div>

Hi,  
I like the NAVBAR, discussed below:

> **[Babylon.js Playground](https://playground.babylonjs.com/#4RTUCB%2364)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

question: How to place NAVBAR inside the stackpanel above the 3 columns, keeping same size?

Any ideas how to combine the two would be extremely helpful. The advancedTexture variable  
doesn’t seem compatible with panels as a stack item in the following 3 panel scene:

> **[Babylon.js Playground](https://playground.babylonjs.com/#CS3Y50%232)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [September 5, 2023, 8:50pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/14 "2023-09-05T20:50:35Z")

</div>

cc @carolhmj our gui expert

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 5, 2023, 8:54pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/15 "2023-09-05T20:54:16Z")

</div>

Assigned @carolhmj on September 5, 2023, 8:54pm UTC



---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 6, 2023, 7:02pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/16 "2023-09-06T19:02:00Z")

</div>

Can you describe a bit more the layout you want?

---

<div class="post-metadata">

**Author:** ![pdotpup](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pdotpup/32/37958_2.png) [@pdotpup](https://forum.babylonjs.com/u/pdotpup)\
**Post date:** [September 6, 2023, 11:50pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/17 "2023-09-06T23:50:25Z")

</div>

Hi Carolhmj,

I want the NAVBAR to appear in the top grid-ROW in the following updated example.

> **[Babylon.js Playground](https://playground.babylonjs.com/#CS3Y50%236)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

not sure if the NAVBAR can have a 2nd advancedTexture to attach onto PANEL0.

Thanks,

---

<div class="post-metadata">

**Author:** ![pdotpup](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pdotpup/32/37958_2.png) [@pdotpup](https://forum.babylonjs.com/u/pdotpup)\
**Post date:** [September 27, 2023, 7:39pm UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/18 "2023-09-27T19:39:05Z")

</div>

Hi didn’t get a reply but I created a workaround using a (sort of) dashboard thingy. 🙂  
thanks. But last question: How can the navbar show other images below? The sphere and ground do not show in the demo below, only the NAVBAR above. If I add " loadGUI.dispose()" then the NAVBAR is disabled but can’t seem to have both at the same time.

> **[Babylon.js Playground](https://playground.babylonjs.com/#4RTUCB%2364)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 28, 2023, 11:28am UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/19 "2023-09-28T11:28:21Z")

</div>

Hello! Apologies, I was a bit pressed for time recently 😅 But glad you arrived at a solution!

About showing the images, it’s because the rectangle where the navbar was in had a opaque background color, just switch that to a transparent one and it’s good to go: [Load GUI From Snippet Server | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#4RTUCB#88)

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 28, 2023, 11:28am UTC](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791/20 "2023-09-28T11:28:24Z")

</div>

Unassigned @carolhmj on September 28, 2023, 11:28am UTC



[Next page](https://forum.babylonjs.com/t/babylon-gui-responsive-top-menu/26791.md?page=2)
