A card-styled wrapper that gives R plot output (a shiny::plotOutput(),
htmlwidget, canvas, or inline SVG) the shadcn chart look: header title /
description, an aspect-locked body, an optional legend strip auto-colored from
the chart tokens, and a footer caption. Pair with the theming adapters in
shad_theme_ggplot2() / shad_theme_plotly() so the plot itself follows the
active theme.
Usage
shad_chart_container(
...,
title = NULL,
description = NULL,
footer = NULL,
legend = NULL,
legend_labels = NULL,
aspect = c("video", "square", "wide", "auto"),
plain = FALSE,
class = NULL
)Arguments
- ...
The plot output (and any extra named attributes) placed in the chart body.
- title
Optional chart title.
- description
Optional description under the title.
Optional footer caption.
- legend
Optional legend: a named character vector
c("Label" = color), orTRUEto auto-color a suppliedlegend_labelsvector from the chart tokens, or a tag.NULLomits the legend.- legend_labels
Character labels used when
legend = TRUE.- aspect
"video"(16:9, default),"square","wide"(21:9), or"auto"(natural height).- plain
If
TRUE, drop the card border/background (--plainvariant).- class
Extra CSS classes.
See also
Other shadshiny dashboard:
shad_mini_donut(),
shad_sparkline(),
shad_timeline(),
shad_timeline_item(),
shad_value_box()
Examples
if (interactive()) {
shad_chart_container(
shiny::plotOutput("p"),
title = "Monthly revenue", description = "Jan - Jun 2026"
)
}