Skip to contents

Wraps a plot output in a bslib::card() with a help icon in the header. Clicking the icon shows a popover with the plot's description and interpretation from av_plot_info.

Usage

av_ui_plot_card(
  output_id,
  plot_id,
  height = "400px",
  max_height = NULL,
  output_type = c("plot", "plotly"),
  full_screen = TRUE,
  footer = NULL,
  sidebar = NULL,
  export = TRUE
)

Arguments

output_id

Character. The Shiny output ID for the plot.

plot_id

Character. The ID in av_plot_info for metadata.

height

Character. CSS height for the plot output (default "400px").

max_height

Character or NULL. CSS max-height for the card container. When set, the card becomes scrollable if content exceeds this height.

output_type

Character. Either "plot" (default) for shiny::plotOutput or "plotly" for plotly::plotlyOutput.

full_screen

Logical. Enable fullscreen toggle on the card (default TRUE).

Optional. A shiny::tags element to add as card footer.

sidebar

Optional. A bslib::sidebar() element for plot controls.

export

Logical. Append a collapsed figure-export block (size, dpi, format, download button) to the card footer (default TRUE). The matching server handler is av_server_plot_download(output_id, ...); without it the download button stays dead.

Value

A bslib::card() shiny.tag.

Examples

# The card wraps shiny::plotOutput("dashboard_ecdf") and takes its header,
# description and interpretation from the "distribution" registry entry.
card <- av_ui_plot_card("dashboard_ecdf", plot_id = "distribution",
                        height = "300px")
class(card)
#> [1] "bslib_fragment" "shiny.tag"     
grepl("dashboard_ecdf", as.character(card), fixed = TRUE)
#> [1] TRUE

# Drop the export block when no av_server_plot_download() handler exists,
# otherwise the card shows a download button that never responds.
plain <- av_ui_plot_card("dashboard_ecdf", "distribution", export = FALSE)
grepl("Export figure", as.character(plain), fixed = TRUE)
#> [1] FALSE