Every example is a complete Vue file. Copy it into an app that has the registry installed, or open it in StackBlitz.
Product photos
Every tile keeps 4:3, so the grid stays even while photos load and when one is missing.
- Jasmine green tea, 100 g85,000 ₫
- Ceramic cup, white120,000 ₫
AspectRatioProduct.vue
<script setup lang="ts">
import { ImageOff } from '@lucide/vue'
import { AspectRatio } from '@/components/ui/aspect-ratio'
// Product photos arrive in any shape. A 4:3 frame keeps the grid even while they load, and when one is missing.
const products = [
{ name: 'Jasmine green tea, 100 g', price: '85,000 ₫' },
{ name: 'Ceramic cup, white', price: '120,000 ₫' },
]
</script>
<template>
<ul class="m-0 grid w-full max-w-120 list-none grid-cols-2 gap-(--bh-space-200) p-0">
<li v-for="product in products" :key="product.name" class="flex flex-col gap-(--bh-space-100)">
<AspectRatio :ratio="4 / 3">
<div
role="img"
:aria-label="`No photo yet for ${product.name}`"
class="flex size-full items-center justify-center rounded-(--bh-radius-card) border-(length:--bh-border-width-default) border-(--bh-color-border) bg-(--bh-color-surface-subtle) text-(--bh-color-icon-subtle)"
>
<ImageOff aria-hidden="true" class="size-(--bh-size-icon-empty)" />
</div>
</AspectRatio>
<span class="text-(--bh-color-text) [font:var(--bh-font-label-default)]">{{ product.name }}</span>
<span class="text-(--bh-color-text-subtle) [font:var(--bh-font-body-default)]">{{ product.price }}</span>
</li>
</ul>
</template>Video frame
A 16:9 frame reserves the space before the video loads, so the page does not jump.
AspectRatioVideo.vue
<script setup lang="ts">
import { CirclePlay } from '@lucide/vue'
import { AspectRatio } from '@/components/ui/aspect-ratio'
// A 16:9 frame reserves the video's space before it loads, so the text below does not jump.
</script>
<template>
<div class="w-full max-w-120">
<AspectRatio :ratio="16 / 9">
<button
type="button"
class="flex size-full cursor-pointer flex-col items-center justify-center gap-(--bh-space-100) rounded-(--bh-radius-card) border-(length:--bh-border-width-default) border-(--bh-color-border) bg-(--bh-color-surface-subtle) text-(--bh-color-text) [font:var(--bh-font-label-default)] hover:bg-(--bh-color-background-neutral-subtle-hover) focus-visible:outline-solid focus-visible:outline-(length:--bh-border-width-focused) focus-visible:outline-(color:--bh-color-border-focus) focus-visible:outline-offset-(--bh-state-focus-offset)"
>
<CirclePlay aria-hidden="true" class="size-(--bh-size-icon-empty) text-(--bh-color-icon-subtle)" />
Play: connect your online store (3 min)
</button>
</AspectRatio>
</div>
</template>