Navigation options

Feel dumb for asking this question… Using the navigation package and cant seem to display the nav menu horizontally… only vertically as in the navigation demo below. I suppose I could create separate column panels, but that seems unnecessary.

I also saw this post and expect I could change the slot value in the underlying navigation dependency, however I am not sure which values are appropriate/possible, other than those already listed.

Any help would be much appreciated.

Hi @xxyjoel

There are several posts on the forum regarding horizontal repeating panels. Here are two of them to get you started:

https://anvil.works/forum/t/horizontal-repeatingpanel-again/27130

dont know how I missed that post! thanks @owen.campbell!

edit: on a closer look, the horizontal repeating panel is not exactly what I was looking for. I was looking for a horizontal navigation menu. unless you are suggesting a repeating panel be used as the menu item?

currently I have a series of links setup, which work fine, though I am missing the routing / hash functionality present in the navigation demo posted above. was hoping I could pass a dict into navigation.build_menu()

E.g.

menu = [
  {"text": "Home", "target": "home", "icon": "fa:home"},
  {"text": "About", "routing": "hash", "target": "about", "icon": "fa:info"},
  {"text": "Contact", "routing": "hash", "target": "contact", "icon": "fa:envelope"},
  {
    "text": "Settings",
    "target": "settings",
    "icon": "fa:gear",
    "visibility": {
      "x-advanced-mode-enabled": True,
      "x-advanced-mode-disabled": False
    }
  }
]

@routing.main_router
class Main(MainTemplate):
  
  def __init__(self, **properties):
    self.advanced_mode = False
    navigation.build_menu(self.menu_column_panel, menu)
    self.init_components(**properties)

You could use a flow panel as the container and pass that as the first argument to the build_menu function.

1 Like