rdashboardquarto

Scrolling on only some pages in Quarto dashboard


In Quarto we have the scrolling option for Dashboards which can be really usefull. But this will be applied to all pages on your dashboard. I would like to have this only on some pages. Here I created a simple reproducible example:

---
title: "Scrolling"
format: 
  dashboard:
    scrolling: true 
---
       
# Page 1

```{r}
head(mtcars)
```

```{r}
plot(mtcars$mpg, mtcars$cyl)
```


# Page 2
    
```{r}
plot(mtcars$carb, mtcars$vs)
```

enter image description here

On Page 1 the scrolling option is really useful since we have multiple items, but on Page 2 I don't want a scrolling option because not necessary (this is really simple example). So I was wondering how we can use the scrolling option on only some pages in Quarto Dashboards?


Solution

  • You can set the scrolling property at the page level using the Pandoc fenced div notation. For example:

    ---
    title: "Scrolling"
    format: 
      dashboard:
        scrolling: false 
    ---
           
    # Page 1 {scrolling="true"}
    
    ```{r}
    head(mtcars)
    ```
    
    ```{r}
    plot(mtcars$mpg, mtcars$cyl)
    ```
    
    
    # Page 2
        
    ```{r}
    plot(mtcars$carb, mtcars$vs)
    ```
    

    Output

    Page 1 (scrollable):

    enter image description here

    Page 2 (fitted to page):

    enter image description here