quarto-dev / quarto-dev/quarto-cli
shiny::downloadButton not appearing in Quarto Shiny document
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
I'm having an issue getting shiny::downloadButton to appear in a shiny document through Quarto. I can get shiny::downloadLink to correctly appear and download data as expected.
I am on:
- Quarto version 0.9.464
- RStudio 2022.02.1+461 "Prairie Trillium" Release (8aaa5d470dd82d615130dbf663ace5c7992d48e3, 2022-03-17) for Windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36 - R version 4.1.3 (2022-03-10)
I tested this with a new Quarto Shiny presentation, with only minor additions. This version has downloadButton, which doesn't work, but changing it to downloadLink works as expected:
---
title: "Test"
format: html
server: shiny
---
## Shiny Documents
This Quarto document is made interactive using Shiny. Interactive documents allow readers to modify parameters and see the results immediately. Learn more about Shiny interactive documents at <https://quarto.org/docs/interactive/shiny/>.
## Inputs and Outputs
You can embed Shiny inputs and outputs in your document. Outputs are automatically updated whenever inputs change. This demonstrates how a standard R plot can be made interactive:
```{r}
sliderInput("bins", "Number of bins:",
min = 1, max = 50, value = 30)
plotOutput("distPlot")
downloadButton(outputId = 'faithfulData')
```
```{r}
#| context: server
output$distPlot <- renderPlot({
x <- faithful[, 2] # Old Faithful Geyser data
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
output$faithfulData <-
downloadHandler(
filename = function() {
paste0('data.csv')
},
content = function(file) {
write.csv(
x = faithful,
file = file
)
}
)
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Render the minimal Quarto Shiny document from the issue and compare the behavior of downloadButton with downloadLink. Start by tracing how the Shiny document handles the downloadButton example, then verify that the button appears and that its download handler works as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100