Skip to content

shiny::downloadButton not appearing in Quarto Shiny document #999

@AnthonyRaborn

Description

@AnthonyRaborn

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
        )
    }
  )
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingshinyRelated to shiny integration for interactive documentthird-partyIssues involving interaction with a third-party library

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions