Registry / web-framework / dash-bootstrap-templates

dash-bootstrap-templates

JSON →
library2.1.0pypypi✓ verified 86d ago

Provides Plotly figure templates that match Bootstrap themes for Dash apps, enabling seamless theming and a built-in theme switch component (ThemeSwitchAIO). Current version 2.1.0 requires Plotly 6. Released monthly with minor features and fixes.

pip install dash-bootstrap-templates
INSTALL
IMPORT
SIG · DASH-BOOTSTRAP-TEM
D
dash-bootstrap-templates
web-frameworkpythonv2.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

load_figure_template
from dash_bootstrap_templates import load_figure_template
from dash_bootstrap_templates.templates import load_figure_template
Templates module is internal; use top-level import.

Load the bootstrap template and apply it to a Plotly Express scatter plot.

import dash from dash import dcc, html from dash_bootstrap_templates import load_figure_template import dash_bootstrap_components as dbc import plotly.express as px load_figure_template('bootstrap') app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP]) df = px.data.gapminder() fig = px.scatter(df.query("year==2007"), x="gdpPercap", y="lifeExp", size="pop", color="continent", template='bootstrap') app.layout = dbc.Container([dcc.Graph(figure=fig)]) if __name__ == '__main__': app.run(debug=True)
Debug
Known issues
breakingVersion 2.0.0+ requires Plotly 6. Projects using Plotly 5 must pin to dash-bootstrap-templates==1.3.0.
fix
pip install dash-bootstrap-templates==1.3.0 if you cannot upgrade Plotly.
affects: >=2.0.0
deprecatedThe 'dbc_css' parameter in load_figure_template is deprecated and may be removed in future versions.
fix
Do not pass dbc_css; the function auto-detects stylesheets.
affects: >=1.0.0
gotchaThemeSwitchAIO requires dash-bootstrap-components >=1.0.0 and the initial theme must be passed as a string (e.g., 'BOOTSTRAP'), not as an object.
fix
Use dbc.themes.BOOTSTRAP (string) for the themes parameter.
affects: >=1.2.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'dash_bootstrap_templates'
Package not installed or installed in wrong environment.
fix
pip install dash-bootstrap-templates
dash.exceptions.NoLayoutException: The layout was None at the time the app was started.
load_figure_template() called before app layout is defined, or missing template parameter in figure.
fix
Ensure load_figure_template() is called early, and pass template='bootstrap' or similar to Plotly figures.
Upgrade
Version history
2.1.0latest on PyPI · released Feb 13, 2025
Audit
Dependencies
plotlyrequiredCore requirement for figure templates. Version >=6 required for v2.x.
dash-bootstrap-componentsrequiredRequired for bootstrap themes and ThemeSwitchAIO component.
Agent activity
18 hits · last 30 days
node
14
OpenAI (training)
1
Resources
dash-bootstrap-templates — pip install dash-bootstrap-templates · libregistry