Gå til indhold

Komponenter

Højde-bredde-forhold

Begrænser indholdet til et fast forhold mellem bredde og højde.

Brug

Grundlæggende

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>

Ultrabredt

Alle forhold mellem bredde og højde fungerer, ikke kun de almindelige.

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>

Kvadratiske miniaturebilleder

Tre kvadrater i en stak bevarer formen, når rækken bliver smallere.

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>

Underelementerne centreres i rammen, så en opfordring til handling ikke behøver sin egen omslutning.

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>

Attributter

AttributTypeStandard
ratio text 16/9
background text —