我想在我的bslib::card
的右边加上一个downloadButton
.理想情况下,这将是一个图标.到目前为止我所做的是
require(shiny)
require(bslib)
require(ggplot2)
ui <- bslib::page_fillable(
theme=bslib::bs_theme(version=5),
title = "Card with Download Icon",
bslib::card(
bslib::card_header(
class = "d-flex justify-content-between",
"Card Title",
shiny::downloadButton(
outputId="download",
label="",
icon=shiny::icon("image") # way too large
)
),
shiny::plotOutput("the_plot")
)
)
server <- function(input, output, session) {
plot_obj <- shiny::reactive(
ggplot2::qplot(Sepal.Length, Sepal.Width, data = iris)
)
output$the_plot <- shiny::renderPlot(plot_obj())
output$download <- shiny::downloadHandler(
filename = function() "card_snapshot.png",
content = function(file) {
ggplot2::ggsave(
filename=file, plot=plot_obj(), device=png,
width=16, height=9, units="cm", bg="white"
)
}
)
}
shiny::shinyApp(ui, server)
但是这导致了太大的卡头,即,
我想知道如何创建一个更小的图标下载?
我也试过shiny::downloadLink
次,但似乎没有icon
次的争论...
任何提示赞赏!