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
| Part | File | Does |
|---|---|---|
| AspectRatio | AspectRatio.vue | Keeps its content at a fixed width-to-height ratio. |
Styling
| Part | Recipe |
|---|---|
| AspectRatio | aspect-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.
| Prop | Type | Default | |
|---|---|---|---|
| ratio | number | 1 | |
| asChild | boolean | false | |
| as | AsTag | Component | — | |
| class | ClassValue | — | |
| Slot | Slot props | |
|---|---|---|
| default | { aspect: number; } | |
| Recipe aspect-ratio | Sets | |
|---|---|---|
| base: aspect-ratio | 1 property | |
Example