Skip to content

Components

Aspect Ratio

Locks content to a fixed width-to-height ratio.

Usage

Basic

16 by 9

HTML
<bs:bsui-aspect-ratio ratio="16/9" background="var(--color-surface)">
  <bs:bsui-text content="16 by 9" variant="muted" />
</bs:bsui-aspect-ratio>

Ultrawide

Any width to height pair works, not only the common ones.

21 by 9

HTML
<bs:bsui-aspect-ratio ratio="21/9" background="var(--color-surface)">
  <bs:bsui-text content="21 by 9" variant="muted" />
</bs:bsui-aspect-ratio>

Square thumbnails

Three squares in a stack keep their shape as the row narrows.

Cover

Spread

Back

HTML
<bs:bsui-stack direction="row" gap="3" align="stretch">
  <bs:bsui-aspect-ratio ratio="1/1" background="var(--color-surface)">
    <bs:bsui-text content="Cover" variant="muted" />
  </bs:bsui-aspect-ratio>
  <bs:bsui-aspect-ratio ratio="1/1" background="var(--color-surface)">
    <bs:bsui-text content="Spread" variant="muted" />
  </bs:bsui-aspect-ratio>
  <bs:bsui-aspect-ratio ratio="1/1" background="var(--color-surface)">
    <bs:bsui-text content="Back" variant="muted" />
  </bs:bsui-aspect-ratio>
</bs:bsui-stack>

Children are centred inside the frame, so a call to action needs no wrapper of its own.

Ship your first block today

HTML
<bs:bsui-aspect-ratio ratio="3/1" background="var(--color-surface)">
  <bs:bsui-stack direction="column" gap="3" align="center">
    <bs:bsui-text content="Ship your first block today" variant="title" tag="h3" />
    <bs:bsui-button label="Read the quickstart" variant="outline" size="sm" />
  </bs:bsui-stack>
</bs:bsui-aspect-ratio>

Attributes

AttributeTypeDefault
ratio text 16/9
background text —