Search code examples
quartoreveal.js

Incremental list with tables in RevealJS Quarto


I would like to have a slide with incremental lists with a table. Here is some reproducible code:

---
title: "Incremental list with tables"
format: revealjs
---

## Slide

::: {.incremental}

- Here some text

```{r}
#| echo: false
#| warning: false
#| message: false
library(knitr)
kable(head(iris))
```

- Table above should be incremental with these list points

:::

Output:

enter image description here

The problem is that the table will be always visible and isn't incremental even when using {.incremental}. So I was wondering if anyone knows how to create an incremental list of text and tables in revealJS Quarto?


Solution

  • Fragments are what you might need.

    Fragments are used to highlight or incrementally reveal individual elements on a slide.

    Also,

    if you have a slide that has more content than can be displayed on a single frame there are two slide-level classes you can apply to mitigate this:

    .smaller class for a smaller typeface and .scrollable class to make off-slide content available by scrolling.

    ---
    title: "Incremental list with tables"
    format: revealjs
    ---
    
    ## Slide {.scrollable .smaller}
    
    ::: {.fragment fragment-index=1}
    - Here some text  
    
    ```{r}
    #| echo: false
    #| warning: false
    #| message: false
    library(knitr)
    kable(head(iris))
    ```
    :::
    
    ::: {.fragment fragment-index=2}
    - Table above should be incremental with these list points
    :::