Aspect Ratio
#

The va-aspect-ratio is a wrapper, that may help you to view your block with the required width to height ratio.

Examples
#

Default
#

16/9

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

4/3

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

1/1

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Open in GitHub

With other components
#

You're able to combine the va-aspect-ratio components with others. By default it's already used in va-image, but also will be useful in, for example, va-card.

4/3
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Open in GitHub

API
#

Props #

NameDescriptionTypesDefault
contentHeight

Wrapper height, it's used with content-width to replace the ratio property.

Number

1

contentWidth

Wrapper width, it's used with content-height to replace the ratio property.

Number

1

maxWidth

Maximal component's width.

Number | String

0

preset

Named preset combination of component props.

String

-

ratio

Aspect ratio of the component's wrapper.

Number | String

"auto"

Css Variables #

NameDefault Value
--va-aspect-ratio-position relative
--va-aspect-ratio-overflow visible

Change log #