I’m pleased to announce that "Dash pages/
" preview is now available in Dash Labs
This new feature simplifies creating multi-page Dash apps. See the initial announcement and forum discussion. We moved this to Dash Labs to make it easier for you to try it out (pip install dash-labs==1.0.0
) and give feedback.
Background
Dash Labs is used to develop new features for future releases of Dash. You can see the community discussion on the progress prior to Dash 2.0 in the initial announcement and in subsequent releases.
Here are some features that started in Dash Labs and were added to Dash >= 2.0.
- New in Dash 2.0: Flexible Callback Signatures
- New in Dash 2.0: All-in-One Components
- New in Dash 2.0: Long Callbacks
- Coming in Dash 2.1: low-code shorthands for Dash Core Components and the dash DataTable.
- Coming in Dash 2.1, The Input, State, and Output accepts components as an alternative to ID strings. Dash will auto-generate the component’s ID under-the-hood if not supplied.
- Available in the dash-bootstrap-templates library: Bootstrap- themed figures.
The documentation for these initial projects in dash-labs
is still available in the current version of dash-labs, but the code is not. The code for the older versions are available in dash-labs v0.4.0. (pip install dash-labs==0.4.0
)
Dash Labs V1.0.0
Dash Labs is now set up to develop new features starting with dash>=2.0
and dash-bootstrap-components>=1.0.
The first new project we’ve added is the Dash pages/
feature. We’ll be adding more new projects in the coming months.
We received a lot of great feedback from the community in our previous announcement (thank you!) and opened up issues for those requests.
Give it a try! See links to the new documentation below. We encourage you take the new features for a spin and to join the discussion, raise issues, make pull requests, and take an active role in shaping the future of Dash.
Dash pages/
Documentation
Quickstart:
pip install dash-labs==1.0.0
app.py
import dash
import dash_labs as dl
import dash_bootstrap_components as dbc
app = dash.Dash(
__name__, plugins=[dl.plugins.pages], external_stylesheets=[dbc.themes.BOOTSTRAP]
)
navbar = dbc.NavbarSimple([
dbc.NavItem(dbc.NavLink(page['name'], href=page['path']))
for page in dash.page_registry.values()
if page["module"] != "pages.not_found_404"
], brand='Dash App')
app.layout = dbc.Container(
[navbar, dl.plugins.page_container],
)
if __name__ == "__main__":
app.run_server(debug=True)
pages/home.py
import dash
from dash import dcc, html, Input, Output, callback
dash.register_page(__name__, path="/")
layout = html.Div([
html.H1('Home Page')
])
pages/historical_analysis.py
import dash
from dash import dcc, html, Input, Output, callback
dash.register_page(__name__, path="/historical-analysis")
layout = html.Div([
html.H1('Historical Analysis Page')
])
In-Depth Guides
- 08-MultiPageDashApp.md
- 09-MultiPageDashAppExamples.md
- 📣 Introducing Dash `/pages` - A Dash 2.1 Feature Preview
We welcome all pull requests to help improve the dash-labs documentation, even as minor as fixing a typo or writing a better sentence. If you would like to contribute to Dash, but are not sure how, this is a great place to start.
Our goal is to create high quality documentation that can be added directly to the official Dash documentation when new features are added to Dash. You can help – even if you’re new to Dash. Try following the instructions to make a multi-page app. Did we miss any steps? Is anything unclear? If so, let us know either here or in the GitHub issue tracker.