Dash for R
You can now use dash-bootstrap-components with Dash for R! Note that support for Dash for R is still in beta so proceed with caution. If you try it out and run into issues, please let us know!
To get started make sure you have installed Dash for R. If you didn't already install it in order to install Dash for R, we also need to make sure that the devtools library is installed.
You can then install dash-bootstrap-components from the
r-release branch of our GitHub repository.
r-release branch will always point to the latest R release. If you want a specific version you can install it by referencing with a tag of the form
X.X.X is the desired version number. For example to install version
0.10.0 you could do
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
dbcThemes list, which can be used as follows:
library(dash) library(dashBootstrapComponents) app <- Dash$new(external_stylesheets = dbcThemes$BOOTSTRAP)
For more information on available themes see the themes documentation
Build the layout
With CSS linked, you can start building you app's layout with out Bootstrap components. Currently there isn't documentation for the R components, but check out component documentation for a full list of available components with Python documentation. The R components work the same way with the same arguments. You can also try running this minimal example to get started.
library(dash) library(dashBootstrapComponents) library(dashHtmlComponents) app <- Dash$new(external_stylesheets = dbcThemes$BOOTSTRAP) app$layout(dbcContainer(dbcAlert("Hello Bootstrap!", color = "success"), className = "p-5")) app$run_server(showcase = TRUE)