Skip to contents

Constrains children to a fixed width/height ratio.

Usage

shad_aspect_ratio(..., ratio = 16/9, class = NULL)

Arguments

...

Child content (typically an <img>), and optional attributes.

ratio

Numeric aspect ratio (width / height). Default 16/9.

class

Extra CSS classes.

Value

A <div class="shad-aspect-ratio">.

Examples

shad_aspect_ratio(htmltools::tags$img(src = "x.png"), ratio = 1)
#> <div class="shad-aspect-ratio" style="--shad-ratio: 1;">
#>   <img src="x.png"/>
#> </div>