For AI agents: the complete documentation index is at llms.txt. Markdown versions are available by appending .md or sending Accept: text/markdown.
Reflex Logo
Docs Logo
Library

/

Layout

/

Aspect Ratio

Aspect Ratio

Displays content with a desired ratio.

Basic Example

Setting the ratio prop will adjust the width or height of the content such that the width divided by the height equals the ratio. For responsive scaling, set the width or height of the content to "100%".

Widescreen 16:9
Letterbox 4:3
Square 1:1
Portrait 5:7
Expand

API Reference

rx.aspect_ratio

Displays content with a desired ratio.

Props

PropTypeDescription
ratio
Union[float, int]

The ratio of the width to the height of the element.

Built with Reflex