Hide Sidebar/Navbar

Dan Rosenstein:
It’s been a while since I looked at this, so may have forgotten, but how do I hide the left menu? I thought it was the ‘state’ in the Data Model tab: “state”: {
“showSideNavBar”: false,
“showTopNavBar”: false,
“sidebarMini”: false,
“sidebarOpen”: false
}


Dan Rosenstein:
it still shows


Andrew Dam:
Do you want to hide it entirely or just shrink?


Andrew Dam:
To control the navbars programmatically, the keys to change are found in vueapp.$store.state.site

For example, you can hide the sidebar using:
vueapp.$store.state.site.showSideNavBar = false


Dan Rosenstein:
hide. but isnt that the same as setting the state-showsidenavbar to false?


Dan Rosenstein:
in Data Model?


Andrew Dam:
The data model has no bearing on whether or not the navbars are present.


Dan Rosenstein:
ok. So best practice would be? run an action on load to hide?


Andrew Dam:
It’s a tad tricky, since if you need to hide them on one page, but visible on another, then you would need to turn it back on when you load the other page.

But yes, in general you can run a function onFormLoad which toggles the boolean.


Andrew Dam:
A more complex but flexible option would be to set up a navigation guard that checks the slug you’re pathing to and setting the keys there.


Dan Rosenstein:
:+1:I don’t think I will need it that flexible. Doing a phone form.


Dan Rosenstein:
BTW, are there any examples of phone specific examples? (I know they are all responsive)


Andrew Dam:
I should have asked this before, but do you need the sidebar to be shown at all? Because the Styling tab has a toggle to turn it off for your entire app.

I don’t think we have a specific example of a phone app, but Tailwind UI templates are almost all responsive out of the box.


Dan Rosenstein:
no - trying to hide it


Andrew Dam:
Then in the Styling tab, you can uncheck these options


Dan Rosenstein:
so just delete the slot position?


Dan Rosenstein:
oh, didnt see that


Dan Rosenstein:
cool - will try


Dan Rosenstein:
Thanks Andrew!


Andrew Dam:
No problem, should have brought that up first but made it more complicated than it needed to be :sweat_smile:


Dan Rosenstein:
all good! thanks again


Dan Rosenstein:
hmm seems to be ignoring it


Dan Rosenstein:
I’ll double check to see if I have code that is doing that


Dan Rosenstein:
yep - that was it!