Preserve the ratio of the components contained within a region.

rc.box(
    element="iframe",
    src="https://bit.ly/naruto-sage",
    border_color="red",
)
rc.aspect_ratio(
    rc.box(
        element="iframe",
        src="https://bit.ly/naruto-sage",
        border_color="red",
    ),
    ratio=4 / 3,
)

rc.AspectRatio

AspectRatio component is used to embed responsive videos and maps, etc.

PropType | ValuesDefault
ratio
float

Event Triggers

See the full list of default event triggers