dash-labs
dash-labs copied to clipboard
Home button callback
Hello everyone! Thanks for your awesome work on this!
I have a request. Could we add a "Go to home" button, or some way to configure a clickable that returns the user to the home page? I know the dash bootstrap components has buttons but I'm not sure how to make the callback work with the new multi-app plugin structure. Thank you in advance!
Hi @gh-jrakijas
One of the cool things about the pages plug-in is that it handles the page navigation for you "under the covers" - no callbacks required :tada: .
To make a home button, you could use a dash-bootstrap components dbc.Button because it has an href property:
You can put this anywhere in your layout
dbc.Button("Go Home!", href="/")
Otherswise you can wrap an html.Button (or an icon or image...) in an html.A Anchor component, for example:
html.A(html.Button("Go Home!"), href="/")
If you are using dash-mantine-components:
dmc.Anchor(dmc.Button("Go Home!), href="/")
I hope this helps - let me know if you have more questions :slightly_smiling_face:
This is exactly what I was looking for. Thank you so much! I'll write again if I struggle with the implementation!