← Back to Components

Image Output

shadcn-styled frames around Shiny's reactive imageOutput/renderImage raster outputs.

Interactive Playground

R Code

API Reference

block_image_output()

Frames a reactive shiny::imageOutput() (renderImage()) in a shadcn-styled aspect/border/radius/caption box. App-author server code stays vanilla Shiny.

ArgumentTypeDefaultDescription
idcharacterrequiredShiny output id, passed verbatim to imageOutput().
widthcharacter"100%"CSS width forwarded to the Shiny output and mirrored on the media box.
heightcharacterNULLCSS height. NULL resolves to "100%" when aspect is set, else Shiny's default.
aspectcharacter | numericNULLMedia-box aspect ratio: NULL, a positive number, or a "w/h" string.
fitcharacter"cover"object-fit for the rendered image: cover, contain, fill, none, scale-down.
borderlogicalFALSEDraw a border around the media box.
roundedlogicalTRUERound the media box corners (and clip overflow).
captioncharacterNULLOptional <figcaption> text below the media box.
click / dblclick / hover / brushcharacter | *Opts()NULLForwarded to the Shiny output unchanged.
inlinelogicalFALSEForwarded to the Shiny output unchanged.
filllogicalFALSEForwarded to the Shiny output; matches shiny::imageOutput().
classcharacterNULLAdditional classes for the <figure> wrapper.
stylecharacterNULLInline style for the <figure> wrapper.