Registry /
web-framework / dash-bootstrap-templates
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)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'dash_bootstrap_templates'
Package not installed or installed in wrong environment.
fixpip 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.
fixEnsure 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.