Skip to content

Commit d2e5ca2

Browse files
authored
Merge pull request #908 from quarto-dev/dashboard-docs-2
Dashboard docs edits
2 parents a38ca20 + 253bd81 commit d2e5ca2

File tree

14 files changed

+166
-145
lines changed

14 files changed

+166
-145
lines changed

docs/dashboards/_dynamic-title.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
::: {.panel-tabset}
2+
3+
## Python
4+
5+
```` {.python .pymd}
6+
```{{python}}
7+
from ipyleaflet import Map, basemaps, basemap_to_tiles
8+
9+
lat = 48
10+
long = 350
11+
12+
print("title=", f"World Map at {lat}, {long}")
13+
14+
Map(basemap=basemap_to_tiles(basemaps.OpenStreetMap.Mapnik),
15+
center=(lat, long), zoom=2)
16+
```
17+
````
18+
19+
## R
20+
21+
````{.markdown}
22+
```{{r}}
23+
library(leaflet)
24+
25+
lat <- 48
26+
long <- 350
27+
28+
cat("title=", "World Map at", lat, long)
29+
30+
leaflet() |> addTiles() |>
31+
setView(long, lat, zoom = 2)
32+
```
33+
````
34+
35+
:::

docs/dashboards/_learning-more.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
[Examples](examples/index.qmd) provides a gallery of example dashboards you can use as inspiration for your own.
66

7-
[Theming](theming.qmd) describes the various way to customized the fonts, colors, layout and other aspects of dashboard apperance.
7+
[Theming](theming.qmd) describes the various way to customize the fonts, colors, layout and other aspects of dashboard appearance.
88

99
[Parameters](parameters.qmd) explains how to create dashboard variants by defining parameters and providing distinct values for them on the command line.
1010

11-
[Deployment](deployment.qmd) covers how to deploy both static dashboards (which do not require a server but rather only a web host) and Shiny dashboards (which require a Shiny Server).
11+
[Deployment](deployment.qmd) covers how to deploy both static dashboards (which require only a web host, but not a server) and Shiny dashboards (which require a Shiny Server).
1212

1313
Interactive dashboards are covered in the articles on using [Shiny for Python](interactivity/shiny-python/index.qmd), [Shiny for R](interactivity/shiny-r.qmd), and [Observable JS](interactivity/observable.qmd).
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
| Color Alias | Theme Color(s) |
2-
|-------------|----------------|
3-
| `primary` | Blue |
4-
| `secondary` | Gray |
5-
| `success` | Green |
6-
| `info` | Bright Blue |
7-
| `warning` | Yellow/Orange |
8-
| `danger` | Red |
9-
| `light` | Light Gray |
10-
| `dark` | Black |
1+
| Color Alias | Default Theme Color(s) |
2+
|-------------|------------------------|
3+
| `primary` | Blue |
4+
| `secondary` | Gray |
5+
| `success` | Green |
6+
| `info` | Bright Blue |
7+
| `warning` | Yellow/Orange |
8+
| `danger` | Red |
9+
| `light` | Light Gray |
10+
| `dark` | Black |

docs/dashboards/components.qmd

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Dashboards are compositions of components used to provide navigation and present
99

1010
## Navigation
1111

12-
All dashboards include a top-level navigation bar that provide a title and (optionally) a logo and author. Dashboards with multiple pages also contain a link to each page on the navigation bar:
12+
All dashboards include a top-level navigation bar that provide a title and (optionally) a logo and author. Dashboards with [multiple pages](#pages) also contain a link to each page on the navigation bar:
1313

14-
![](images/navigation-toolbar.png)
14+
![](images/navigation-toolbar.png){fig-alt="Screenshot of a dashboard navigation bar. The bar begins with a logo of three penguins, then the title Palmer Penguins followed by the author Cobblepot Analytics. There are also three links to pages: Bills, Flippers and Data."}
1515

1616
The `title` and `author` are specified as they are with normal documents. You can also include a `logo` and one or more `nav-buttons`:
1717

@@ -66,23 +66,20 @@ format: dashboard
6666
:::
6767

6868
::: g-col-7
69-
![](images/chart-focal-top.png)
69+
![](images/chart-focal-top.png){fig-alt="A schematic of a page layout showing Chart 1 at the top using the full page width, then Chart 2 and Chart 3 side by side in a row below it."}
7070
:::
7171
:::
7272

73-
Here, level 2 markdown headings (e.g. `## Row {height=70%}`) define the contents of rows as well as their relative height. The ```` ```{python} ```` code cells in turn automatically create cards that are laid out in columns within the row.
73+
Here, level 2 markdown headings (e.g. `## Row {height=70%}`) define the contents of rows as well as their relative height. The ```` ```{python} ```` code cells in turn automatically create cards that are laid out in columns within the row.
7474

75-
### Fill vs. Flow
7675

77-
Each row in your dashboard that is not given an explicit height will determine its size by either filling available space or by flowing to its natural height. Filling layout is generally the default, however for certain types of content (e.g. markdown text) flow layout is the default.
76+
::: {.callout-note}
7877

79-
If the default behavior isn't what you want, you can explicitly specify filling or flowing behavior usign the `.fill` and `.flow` classes applied to a row. For example:
78+
## Heading text isn't required
8079

81-
````{.python .pymd}
82-
## Row {.fill}
80+
Although markdown headings are used to define the layout of rows and columns in Quarto dashboards, the heading text itself is discarded. We use the headings `Row` and `Column` in these docs to aid understanding of the layouts, but you can use more descriptive headings if they help you navigate your source code.
8381

84-
## Row {.flow}
85-
````
82+
:::
8683

8784
### Orientation
8885

@@ -114,10 +111,24 @@ format:
114111
:::
115112

116113
::: g-col-7
117-
![](images/chart-focal-left.png)
114+
![](images/chart-focal-left.png){fig-alt="A schematic of a page layout showing Chart 1 on the left using the full page height, and on the right Chart 2 and Chart 3 are one above the other."}
118115
:::
119116
:::
120117

118+
### Fill vs. Flow
119+
120+
Each row in your dashboard that is not given an explicit height will determine its size by either filling available space or by flowing to its natural height. Filling layout is generally the default, however for certain types of content (e.g. markdown text) flow layout is the default.
121+
122+
If the default behavior isn't what you want, you can explicitly specify filling or flowing behavior usign the `.fill` and `.flow` classes applied to a row. For example:
123+
124+
````{.python .pymd}
125+
## Row {.fill}
126+
127+
## Row {.flow}
128+
````
129+
130+
131+
121132
### Scrolling
122133

123134
By default, dashboard content fills all available space in the page. You can alternatively specify the `scrolling: true` option to layout content using its natural height and scroll to accommodate page overflow. For example:
@@ -144,7 +155,7 @@ format:
144155
:::
145156

146157
::: g-col-7
147-
![](images/chart-stack-scrolling.png)
158+
![](images/chart-stack-scrolling.png){fig-alt="A schematic of a dashboard layout showing three charts stacked vertically."}
148159
:::
149160
:::
150161

@@ -154,7 +165,7 @@ The article on [Dashboard Layouts](layouts.qmd) provides extensive additional ex
154165

155166
## Pages {#pages}
156167

157-
The layout examples above demonstrated only single-page dashboards. To introduce multiple pages, use level 1 headings above the level 2 headings used to define rows and columns. For example, here is a dashboard that splits content across two pages:
168+
The layout examples above demonstrated only single-page dashboards. To introduce multiple pages, use level 1 headings above the level 2 headings used to define rows and columns. The text of the level 1 headings will be used to link to the pages in the navigation bar. For example, here is a dashboard that splits content across two pages:
158169

159170
```` {.python .pymd}
160171
---
@@ -187,7 +198,7 @@ Note that we can set a per-page orientation by adding an `orientation` attribute
187198

188199
## Tabsets {#tabsets}
189200

190-
Use tabsets to include multiple views of data or to include content of secondary importance without having it crown the main display. Tabsets are created by adding the `.tabset` class to a row or column. For example, this layout displays the bottom row as a set of two tabs.
201+
Use tabsets to include multiple views of data or to include content of secondary importance without having it crowd the main display. Tabsets are created by adding the `.tabset` class to a row or column. For example, this layout displays the bottom row as a set of two tabs.
191202

192203
::: {.chart-example .grid}
193204
::: g-col-5
@@ -215,11 +226,11 @@ format: dashboard
215226
:::
216227

217228
::: g-col-7
218-
![](images/chart-tabset-row.png)
229+
![](images/chart-tabset-row.png){fig-alt="Schematic of a dashboard layout showing Chart 1 at the top using the full page width. Below Chart 1, a panel with two tabs is shown: the Chart 2 tab is selected and occupies the full page width; the Chart 3 tab is unselected."}
219230
:::
220231
:::
221232

222-
You can include tabsets at arbitrarily deep levels. Here we include a tabset within a column of a top level row. Each cell within the tabset column becomes a tab.
233+
You can include tabsets at arbitrarily deep levels. Here we include a tabset within a column of a top level row:
223234

224235
::: {.chart-example .grid}
225236
::: g-col-5
@@ -254,21 +265,21 @@ format: dashboard
254265
:::
255266

256267
::: g-col-7
257-
![](images/chart-tabset-card.png)
268+
![](images/chart-tabset-card.png){fig-alt="Schematic of a dashboard layout showing Chart 1 at the top using the full page width. The row below Chart 1 is split into two columns. In the left column is a panel with two tabs: Chart 2 and Chart 3. In the right column is Chart 4."}
258269
:::
259270
:::
260271

261-
We provide navigational titles for our tabs by adding a `title` option to the cell used to produce each tab.
272+
Each cell within the tabset column becomes a tab, and we provide navigational titles for our tabs by adding a `title` option to the cell used to produce each tab.
262273

263-
Note that you can also have tabs that contain only markdown. To do this use a `::: {.card}` div and include a `title` attribute for the tab:
274+
You can also have tabs that contain only markdown. To do this use a `::: {.card}` div and include a `title` attribute for the tab:
264275

265276
````python
266277
::: {.card title="My Title"}
267278
Card text
268279
:::
269280
````
270281

271-
In the examples above, each tab include a single card. If you want tabs to contain multiple cards, you can introduce another level of tab headings, each of which can contain multiple cards. For example:
282+
In the examples above, each tab included a single card. If you want tabs to contain multiple cards, introduce another level of headings below the tabset row or column. For example:
272283

273284
````{.python .pymd}
274285
---
@@ -323,23 +334,23 @@ This text will be displayed within a card
323334
```
324335
````
325336

326-
Note that if you want to provide a title for a markdown card use the `title` attribute. For example:
337+
To provide a title for a markdown card use the `title` attribute. For example:
327338

328339
````python
329340
::: {.card title="My Title"}
330341
This text will be displayed within a card
331342
:::
332343
````
333344

334-
Note that if you are authoring within a Jupyter Notebook then markdown cells automatically become `.content` divs.
345+
Note that if you are authoring within a Jupyter Notebook then markdown cells automatically become `.card` divs.
335346

336-
In the section on [Cell Output](data-presentation.qmd#cell-output) there are additional details on how cells and their content are mapped to cards (e.g. excluding cells, cells with multiple outputs, etc.).
347+
For additional details on how cells and their content are mapped to cards (e.g. excluding cells, cells with multiple outputs, etc.), see [Cell Output](data-presentation.qmd#cell-output).
337348

338349
### Display Options
339350

340351
By default, cards are displayed with no title and a small bit of padding around the edges. Here is a card that displays a [Leaflet](https://ipyleaflet.readthedocs.io) map:
341352

342-
![](images/leaflet-card.png)
353+
![](images/leaflet-card.png){fig-alt="Screenshot of a map inset from a light grey border around the card."}
343354

344355
You can add a title to a card by including the `title` cell option. You can also customize the padding using the `padding` option. For example, here we add a title and remove the padding entirely:
345356

@@ -353,32 +364,18 @@ Map(basemap=basemap_to_tiles(basemaps.OpenStreetMap.Mapnik),
353364
```
354365
````
355366

356-
![](images/leaflet-card-title-padding.png)
367+
![](images/leaflet-card-title-padding.png){fig-alt="Screenshot of a card with the title World Map displayed in the light grey bar at the top. The card contains a map with no inset from the card border."}
357368

358-
You can create a dynamic `title` by printing a `title=` expression as a cell's first output. For example:
359369

360-
```` {.python .pymd}
361-
```{{python}}
362-
from ipyleaflet import Map, basemaps, basemap_to_tiles
363-
364-
lat = 48
365-
long = 350
366-
367-
print("title=", f"World Map at {lat}, {long}")
368-
369-
Map(basemap=basemap_to_tiles(basemaps.OpenStreetMap.Mapnik),
370-
center=(lat, long), zoom=2)
371-
```
372-
````
373-
374-
Note that for R you would use the `cat()` rather than `print()` function.
370+
You can create a dynamic `title` by printing a `title=` expression as a cell's first output. For example:
375371

372+
{{< include _dynamic-title.md >}}
376373

377374
#### Expanding Cards
378375

379376
By default, you can zoom in on the content of cards using the expand button in the bottom right:
380377

381-
![](images/leaflet-card-expandable.png)
378+
![](images/leaflet-card-expandable.png){fig-alt="Screenshot of a card with the cursor hovering over an icon in the bottom right showing the pop up text Expand."}
382379

383380
If you don't want cards to be expandable you can specify `expandable: false` (either at the document level or for individual cards).
384381

@@ -410,7 +407,7 @@ format: dashboard
410407
:::
411408

412409
::: g-col-7
413-
![](images/chart-input-sidebar.png)
410+
![](images/chart-input-sidebar.png){fig-alt="Schematic of a dashboard layout showing a sidebar as grey column on the left filling the page height. On the left, Chart 1 and Chart 2 are one above the other."}
414411
:::
415412
:::
416413

0 commit comments

Comments
 (0)