Documentation

Quickstart

Installation instructions and basic usage.

Installation

PyPI

You can install dash-bootstrap-components with pip:

pip install dash-bootstrap-components

Anaconda

You can also install dash-bootstrap-components with conda through the conda-forge channel:

conda install -c conda-forge dash-bootstrap-components

Basic usage

dash-bootstrap-components is a component library for use with Plotly Dash. If you have not used Dash before, it's strongly recommended you check out the Dash documentation and try building a basic app first.

To use dash-bootstrap-components you must do two things:

  • Link a Bootstrap v4 compatible stylesheet
  • Incorporate dash-bootstrap-components into the layout of your app.

Linking a stylesheet

dash-bootstrap-components doesn't come with CSS included. This is to give you the freedom to use any Bootstrap v4 stylesheet of your choice. This means however that in order for the components to be styled properly, you must link to a stylesheet yourself.

For convenience, links to BootstrapCDN for standard Bootstrap and each Bootswatch theme are available through the themes module, which can be used as follows:

import dash
import dash_bootstrap_components as dbc

app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])

For more information on available themes see the themes documentation

Build the layout

With CSS linked, you can start building your app's layout with our Bootstrap components. See the component documentation for a full list of available components, or try running this minimal example to get started.

import dash
import dash_bootstrap_components as dbc

app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])

app.layout = dbc.Container(
    dbc.Alert("Hello Bootstrap!", color="success"),
    className="p-5",
)

if __name__ == "__main__":
    app.run_server()