9

I would like to create a dropdown menu in Quarto to show multiple plots. In R Markdown is this really simple using # Dropdown menu {.tabset .tabset-dropdown} with some ## for each plot. Here is a reproducible example in R markdown:

---
title: "Dropdown menu in Rmarkdown"
date: "2022-08-29"
output: html_document
---

# Dropdown menu {.tabset .tabset-dropdown}

## Plot 1

```{r, echo=FALSE}
plot(1:10, 10:1)
```

## Plot 2

```{r, echo=FALSE}
hist(rnorm(100))
```

## Plot 3 

```{r, echo=FALSE}
plot(rnorm(10), rnorm(10))
```

Output:

enter image description here

As you can see in the output there is a dropdown menu to show each plot separately. I found some information about Tabsets section in Quarto and maybe thought that using ::: {.tabset-dropdown}) would do the job. I tried the following code in a .tabset-dropdown:

---
title: "Dropdown menu in Quarto"
format: html
---

::: {.tabset-dropdown}

## plot1

```{r}
plot(1:10, 1:10)
```

## plot2

```{r}
hist(rnorm(100))
```

:::

Output:

enter image description here

As you can see in the output, it didn't create a dropdown menu like in R Markdown. So I was wondering if it is possible to achieve the same in Quarto?

shafee
  • 15,566
  • 3
  • 19
  • 47
Quinten
  • 35,235
  • 5
  • 20
  • 53
  • 3
    According to [this issue #419](https://github.com/quarto-dev/quarto-cli/issues/419) on Quarto Github repo, there's no such option right now, but they are considering adding this in the future. – shafee Aug 29 '22 at 17:58
  • @shafee, Thank you for your comment! Let's wait then for the future. – Quinten Aug 30 '22 at 18:37

1 Answers1

0

Not sure if this is what you are looking for, but you can create simply drop-downs for html documents by using:

<details>
<summary>dropdown_title</summary>
contents
</details>