Skip to content

Commit 1200c03

Browse files
authored
Merge pull request #521 from facultyai/julia-docs
Add Julia documentation
2 parents e6b6139 + d7af5e4 commit 1200c03

File tree

10 files changed

+283
-110
lines changed

10 files changed

+283
-110
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ conda install -c conda-forge dash-bootstrap-components
5555

5656
### Dash for R
5757

58-
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](https://github.com/facultyai/dash-bootstrap-components/issues/new?template=bug.md)! To get started make sure you have the _devtools_ library installed
58+
You can now use _dash-bootstrap-components_ with Dash for R! To get started make sure you have the _devtools_ library installed
5959

6060
```r
6161
install.packages("devtools")
@@ -68,7 +68,17 @@ library(devtools)
6868
install_github('facultyai/dash-bootstrap-components@r-release')
6969
```
7070

71-
Check out [the docs for more details](https://dash-bootstrap-components.opensource.faculty.ai/docs/dashr)
71+
Check out [the docs for more details](https://dash-bootstrap-components.opensource.faculty.ai/docs/quickstart)
72+
73+
### Dash.jl
74+
75+
You can also use _dash-bootstrap-components_ with Dash.jl! Install with
76+
77+
```jl
78+
pkg> add DashBootstrapComponents
79+
```
80+
81+
Check out [the docs for more details](https://dash-bootstrap-components.opensource.faculty.ai/docs/quickstart)
7282

7383
## Quick start
7484

docs/content/docs/dashR.md

Lines changed: 0 additions & 74 deletions
This file was deleted.

docs/content/docs/quickstart.md

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ title: Quickstart
88

99
## Installation
1010

11+
Dash Bootstrap components can be used with Dash in Python, R or Julia.
12+
13+
~~~bootstrap-tabs
14+
Python
1115
### PyPI
1216
1317
You can install _dash-bootstrap-components_ with `pip`:
@@ -24,6 +28,44 @@ conda-forge channel:
2428
```sh
2529
conda install -c conda-forge dash-bootstrap-components
2630
```
31+
-----
32+
R
33+
To get started make sure you have [installed Dash for R](https://dashr.plotly.com/installation). 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.
34+
35+
```r
36+
install.packages("devtools")
37+
```
38+
39+
You can then install _dash-bootstrap-components_ from the `r-release` branch of our GitHub repository.
40+
41+
```r
42+
library(devtools)
43+
install_github('facultyai/dash-bootstrap-components@r-release')
44+
```
45+
46+
The `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 `rX.X.X` where `X.X.X` is the desired version number. For example to install version `0.10.0` you could do
47+
48+
```r
49+
library(devtools)
50+
install_github('facultyai/dash-bootstrap-components@r0.10.0')
51+
```
52+
-----
53+
Julia
54+
To get started make sure you have [installed Dash.jl](https://dash-julia.plotly.com/installation). You can then install `DashBootstrapComponents` as follows
55+
56+
```julia-repl
57+
pkg> add DashBootstrapComponents
58+
```
59+
60+
Or alternatively you can install from source as follows
61+
62+
```julia-repl
63+
julia> using Pkg;
64+
julia> Pkg.add(PackageSpec(
65+
url="https://github.com/facultyai/dash-bootstrap-components", rev="julia-release",
66+
))
67+
```
68+
~~~
2769

2870
## Basic usage
2971

@@ -38,21 +80,52 @@ To use _dash-bootstrap-components_ you must do two things:
3880

3981
_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.
4082

41-
For convenience, links to [BootstrapCDN][bootstrapcdn] for standard Bootstrap and each Bootswatch theme are available through the `themes` module, which can be used as follows:
83+
For convenience, links to [BootstrapCDN][bootstrapcdn] for standard Bootstrap and each Bootswatch theme are available as part of _dash-bootstrap-components_ and can be used as follows
84+
85+
~~~bootstrap-tabs
86+
Python
87+
In Python, each CDN link is available within the `dbc.themes` submodule and can
88+
be used when instantiating the `app` object.
4289
4390
```python
4491
import dash
4592
import dash_bootstrap_components as dbc
4693
4794
app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
4895
```
96+
-----
97+
R
98+
Once you have imported _dash-bootstrap-components_ with
99+
`library(dashBootstrapComponents)`, the `dbcThemes` list will be loaded into
100+
your global namespace and can be used when instantiating the `app` object.
101+
102+
103+
```r
104+
library(dash)
105+
library(dashBootstrapComponents)
106+
107+
app <- Dash$new(external_stylesheets = dbcThemes$BOOTSTRAP)
108+
```
109+
-----
110+
Julia
111+
112+
```julia
113+
using Dash, DashBootstrapComponents
114+
115+
app = dash(external_stylesheets=[dbc_themes.BOOTSTRAP])
116+
```
117+
~~~
49118

50119
For more information on available themes see the [_themes documentation_][docs-themes]
51120

52121
### Build the layout
53122

54123
With CSS linked, you can start building your app's layout with our Bootstrap components. See the [_component documentation_][docs-components] for a full list of available components, or try running this minimal example to get started.
55124

125+
~~~bootstrap-tabs
126+
Python
127+
This is a minimal Dash app written in Python.
128+
56129
```python
57130
import dash
58131
import dash_bootstrap_components as dbc
@@ -67,6 +140,38 @@ app.layout = dbc.Container(
67140
if __name__ == "__main__":
68141
app.run_server()
69142
```
143+
-----
144+
R
145+
This is a minimal Dash app written in R.
146+
147+
```r
148+
library(dash)
149+
library(dashBootstrapComponents)
150+
151+
app <- Dash$new(external_stylesheets = dbcThemes$BOOTSTRAP)
152+
153+
app$layout(dbcContainer(dbcAlert("Hello Bootstrap!", color = "success"),
154+
className = "p-5"))
155+
156+
app$run_server(showcase = TRUE)
157+
```
158+
-----
159+
Julia
160+
This is a minimal Dash app written in Julia.
161+
162+
```julia
163+
using Dash, DashBootstrapComponents
164+
165+
app = dash(external_stylesheets=[dbc_themes.BOOTSTRAP])
166+
167+
app.layout = dbc_container(
168+
dbc_alert("Hello Bootstrap!", color="success"),
169+
className="p-5",
170+
)
171+
172+
run_server(app, "0.0.0.0", 8080)
173+
```
174+
~~~
70175

71176
[dash-docs]: https://dash.plotly.com
72177
[dash-docs-external]: https://dash.plotly.com/external-resources

docs/content/docs/themes.md

Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ _dash-bootstrap-components_ doesn't come with CSS included. This is to give you
1010

1111
You can link to a stylesheet served over a CDN, or serve CSS locally depending on your needs.
1212

13-
## The `themes` module
13+
## Packaged CDN links
1414

15-
The `dash_bootstrap_components.themes` module contains links to Bootstrap and Bootswatch stylesheets hosted on [BootstrapCDN][bootstrapcdn] so you can conveniently link to one of them in your app. The easiest way to do so is to use the `external_stylesheets` argument in the `dash.Dash` constructor like this.
15+
_dash-bootstrap-components_ contains links to Bootstrap and Bootswatch stylesheets hosted on [BootstrapCDN][bootstrapcdn] so you can conveniently link to one of them in your app. The easiest way to do so is to use the `external_stylesheets` argument when instantiating your app.
16+
17+
~~~bootstrap-tabs
18+
Python
19+
20+
Links are available in the `dash_bootstrap_components.themes` submodule.
1621
1722
```python
1823
import dash
@@ -21,31 +26,90 @@ import dash_bootstrap_components as dbc
2126
app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
2227
```
2328
24-
This will link the standard Bootstrap stylesheet. To link one of the Bootswatch styles, such as [Cyborg][bootswatch-cyborg] you would just change this to
29+
This will link the standard Bootstrap stylesheet. To link one of the Bootswatch styles, such as [Cyborg](https://bootswatch.com/cyborg/) you would just change this to
2530
2631
```python
2732
import dash
2833
import dash_bootstrap_components as dbc
2934
3035
app = dash.Dash(external_stylesheets=[dbc.themes.CYBORG])
3136
```
37+
-----
38+
R
39+
40+
Links are available in the `dbcThemes` list which is added to your namespace when you import `dashBootstrapComponents`.
41+
42+
```r
43+
library(dash)
44+
library(dashBootstrapComponents)
45+
46+
app <- Dash$new(external_stylesheets = dbcThemes$BOOTSTRAP)
47+
```
48+
49+
This will link the standard Bootstrap stylesheet. To link one of the Bootswatch styles, such as [Cyborg](https://bootswatch.com/cyborg/) you would just change this to
50+
51+
```r
52+
library(dash)
53+
library(dashBootstrapComponents)
54+
55+
app <- Dash$new(external_stylesheets = dbcThemes$CYBORG)
56+
```
57+
-----
58+
Julia
59+
60+
Links are available as part of the `dbc_themes` named tuple available in `DashBootstrapComponents`.
61+
62+
```julia
63+
using Dash, DashBootstrapComponents
64+
65+
app = dash(external_stylesheets=[dbc_themes.BOOTSTRAP])
66+
```
67+
68+
This will link the standard Bootstrap stylesheet. To link one of the Bootswatch styles, such as [Cyborg](https://bootswatch.com/cyborg/) you would just change this to
69+
70+
```julia
71+
using Dash, DashBootstrapComponents
72+
73+
app = dash(external_stylesheets=[dbc_themes.CYBORG])
74+
```
75+
~~~
3276

3377
See the [available themes](#available-themes) for more.
3478

3579
## Manually linking to a CDN
3680

37-
Each theme such as `dash_bootstrap_components.themes.BOOTSTRAP` is simply BootstrapCDN URL stored as a Python string, so using the themes module is really equivalent to doing something like the following.
81+
Each theme such as is simply a BootstrapCDN URL stored as a string, so using the themes module is really equivalent to doing something like the following.
82+
83+
~~~bootstrap-tabs
84+
Python
3885
3986
```python
4087
BS = "https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
4188
app = dash.Dash(external_stylesheets=[BS])
4289
```
90+
-----
91+
R
92+
93+
```r
94+
BS <- "https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
95+
app <- Dash$new(external_stylesheets = BS)
96+
```
97+
-----
98+
Julia
99+
100+
```julia
101+
BS = "https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
102+
app = dash(external_stylesheets=[BS])
103+
```
104+
~~~
43105

44106
You can change this URL to anything you like, for example if you prefer to use a mirror or a different CDN to supply the stylesheet.
45107

46108
## Linking local CSS
47109

48-
You can [download][bootstrap-download] a stylesheet and serve it locally if you prefer. This might be desirable if you are restricted by a firewall or if you want to modify the stylesheet or even [compile your own][bootstrap-compile]. The easiest way to link a local stylesheet is to place it in a folder named `assets/` in the root of the app directory. See the [Dash documentation][dash-docs-external] for more details on this.
110+
You can [download][bootstrap-download] a stylesheet and serve it locally if you prefer. This might be desirable if you are restricted by a firewall or if you want to modify the stylesheet or even [compile your own][bootstrap-compile]. There are tools online to help with this, we recommend [Bootstrap Build](https://bootstrap.build/app).
111+
112+
The easiest way to link a local stylesheet is to place it in a folder named `assets/` in the root of the app directory. See the [Dash documentation][dash-docs-external] for more details on this.
49113

50114
<h2 id="available-themes">Available themes</h2>
51115

@@ -56,9 +120,8 @@ To start with, we recommend experimenting with some of the Bootswatch themes ava
56120
[dash-docs-external]: https://dash.plotly.com/external-resources/
57121
[bootstrapcdn]: https://www.bootstrapcdn.com/
58122
[bootstrap]:https://getbootstrap.com/
59-
[bootstrap-download]: https://getbootstrap.com/docs/4.4/getting-started/download/
60-
[bootstrap-compile]: https://getbootstrap.com/docs/4.4/getting-started/theming/
123+
[bootstrap-download]: https://getbootstrap.com/docs/4.6/getting-started/download/
124+
[bootstrap-compile]: https://getbootstrap.com/docs/4.6/getting-started/theming/
61125
[bootstrap-themes]: https://themes.getbootstrap.com/
62126
[bootswatch]: https://bootswatch.com/
63-
[bootswatch-cyborg]: https://bootswatch.com/cyborg/
64127
[bootswatch-themes]: https://www.bootstrapcdn.com/bootswatch/

0 commit comments

Comments
 (0)