I can’t share the app code because it’s for work, but in general it should be something like this:
First, you need to have a
dcc.Location (I’ll use an
id='url' here) in your base layout, and a div where you’ll include your dynamic contents (
id='app-body'). Then you just use the pathname of the
url component as the input to your app’s body and also the output of your dropdowns and buttons.
# Logic to extract the parameters you need from the pathname. This could vary if you are using a multi-page app, for example
args = pathname.split('/')[-1]
if args = 'ABC':
page_contents = html.Div([something ...])
elif args = 'XYZ':
page_contents = html.Div([something else...])
Then you could have a dropdown for example with id ‘my-dropdown’ and pass the value to the url:
Or a button that does the same:
# When you click the button, change the end of the url to 'ABC'
Furthermore, in your app you could have
dcc.Link components that change the pathname to
href="/XYC", which would trigger the changes in
Hope this helps!