Skip to content
↑↓ to navigate↵ to openesc to close

Menu

Aspect Ratio

Preview

A lakeside cabin beneath mountains, reflected in the water

Install

Add it with your package manager, or copy the source manually.

Run it in a project set up with shadcn-vue. The source is copied to components/beui and its dependencies are added to your package.json. Read the shadcn-vue guide

bunx --bun shadcn-vue@latest add @beui-vue/aspect-ratio

Import the shared styles once in your application.

TSUsage
import AspectRatio from '@/components/beui/primitives/AspectRatio.vue'
import '@/components/beui/styles.css'

API Reference

AspectRatio

ratio?
number

Width divided by height, for example 16 / 9. Must be finite and positive.

Default1
animated?
boolean

Morph layout changes. Reduced motion always skips movement.

Defaulttrue
contentClassName?
string

Classes for the content layer, such as alignment or padding.

Default—
class?
string
Default—

AspectRatioImage

alt
string
Default—
width
number

Intrinsic width in pixels, used to reserve the image's cover crop.

Default—
height
number

Intrinsic height in pixels. Keep these dimensions accurate for the source.

Default—
class?
string
Default—
draggable?
boolean
Default—

Updated