Is it possible to ceate nested subpages with the Dash Pages feature?

I understand that I can use Dash Pages to create multi-page apps with some shared outer layout and an inner dash.page_container that updates automatically based on the URL. I would like to nest a second page_container inside the original one, to achieve e.g. the following effect:

  • route /page/sub1/content1 displays a primary navbar (page), a secondary navbar (sub1) and page content (content1).
  • route /page/sub1/content2 displays its own page content (content2), but shares the primary and the secondary navbar with /page/sub1/content1.
  • route /page/sub2/content3 displays its own page content (content3) and secondary navbar (sub2), but shares the primary navbar with the other two routes.

Is something like this possible with Dash Pages, or do I have to resort to using nested container Divs and callbacks to update the innermost subpages?

Interesting question @Niklas_Kappel.

I am actually unsure whether this is possible but I understand that the pages feature is for top level routing only.

Maybe other users can share their thoughts.

EDIT: well, other users shared their thoughts with me :rolling_on_the_floor_laughing:

Maybe this might help you:

1 Like

hi @Niklas_Kappel ,

From my understanding, you can just follow the solution described in the doc you mentioned and implement either Nested Pages or Multiple Pages in One File. It mainly depends on how you define the path=.

As for things like the navbar, isn’t the content totally up to you and easy to change at any time? For example, you could just listen to the path with a callback to update it or render it as diff navigation paths based on the page’s location.

Here’s a minimal example of using a function to create the secondary navbar

Example #7

1 Like