
Last chance! 50% off unlimited learning
Sale ends in
Use these functions to create a download button; when clicked, it will initiate a browser download. The filename and contents are specified by the corresponding shiny downloadHandler() defined in the server function.
f7DownloadButton(outputId, label = "Download", class = NULL, ...)
The name of the output slot that the downloadHandler is assigned to.
The label that should appear on the button.
Additional CSS classes to apply to the tag, if any.
Other arguments to pass to the container tag function.
if (interactive()) {
library(shiny)
library(shinyMobile)
ui = f7Page(
f7SingleLayout(
navbar = f7Navbar(title = "File handling"),
f7Block(f7DownloadButton("download","Download!"))
)
)
server = function(input, output, session) {
# Our dataset
data <- mtcars
output$download = downloadHandler(
filename = function() {
paste("data-", Sys.Date(), ".csv", sep="")
},
content = function(file) {
write.csv(data, file)
}
)
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab