How to only get menu in home page and back buttons in the rest?

Hi All,

I am building an App with a structure where the user lands on a home page where a side menu can be opened. From the side menu the user can chose to go to some other pages. Now, every page should actually appear somewhat like a modal - therefore the menu-button must be changed to a “back” button on all other pages than the home page.

I actually began implementing this using modals, but I realise that this is maybe bad way to do it, because the pages can have sub-pages and multiple states.

How would you do it? is there a clever feature for this, that I don’t know about? :slight_smile:

There is an attribute called menu-close that appears on links in the sidemenu (if you used one of our starters or the docs). This attribute does the following things:

  • Closes the menu
  • Sets the next view as the root of the history stack
  • Removes the animations from the navigation transition

So you should be able to remove the menu-close attribute from the links in your sidemenu, and then you can use the menu-toggle attribute or call a function to close the menu on click. Here’s an example codepen:

Let me know if this isn’t the case. :smile:

1 Like

Just what I needed!! Thank you, saved the day :kissing:

1 Like