Dropdown menu in Quarto
Asked Answered
E

1

11

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?

Emelina answered 29/8, 2022 at 16:59 Comment(2)
According to this issue #419 on Quarto Github repo, there's no such option right now, but they are considering adding this in the future.Jazminejazz
@shafee, Thank you for your comment! Let's wait then for the future.Emelina
G
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>
Goldina answered 12/5, 2023 at 10:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.