aspect-ratio

Aspect Ratio

Keeps its content at a fixed width-to-height ratio, such as a square product image or a 16:9 video.

States: Default

Parts

PartFileDoes
AspectRatioAspectRatio.vueKeeps its content at a fixed width-to-height ratio.

Styling

PartRecipe
AspectRatioaspect-ratio

Install

Writes 2 files into components/ui/aspect-ratio/. For agents, npx @frontic/ui docs aspect-ratio prints this reference as markdown; the MCP server serves the same.

npm packages
@vueuse/core
reka-ui

API reference

AspectRatio AspectRatio.vue

Keeps its content at a fixed width-to-height ratio.

PropTypeDefault
rationumber1
asChildbooleanfalse
asAsTag | Component—
classClassValue—
SlotSlot props
default{ aspect: number; }
Recipe aspect-ratioSets
base: aspect-ratio 1 property
Example