downloadBttn | R Documentation |
actionBttn
Create a download button with actionBttn()
.
downloadBttn(
outputId,
label = "Download",
style = "unite",
color = "primary",
size = "md",
block = FALSE,
no_outline = TRUE,
icon = shiny::icon("download")
)
outputId |
The name of the output slot that the |
label |
The contents of the button, usually a text label. |
style |
Style of the button, to choose between |
color |
Color of the button : |
size |
Size of the button : |
block |
Logical, full width button. |
no_outline |
Logical, don't show outline when navigating with keyboard/interact using mouse or touch. |
icon |
An optional icon to appear on the button. |
actionBttn()
if (interactive()) {
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
tags$h2("Download bttn"),
downloadBttn(
outputId = "downloadData",
style = "bordered",
color = "primary"
)
)
server <- function(input, output, session) {
output$downloadData <- downloadHandler(
filename = function() {
paste('data-', Sys.Date(), '.csv', sep='')
},
content = function(con) {
write.csv(mtcars, con)
}
)
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.