Bento & Layout
Aspect-Ratio Media Box
Reserves a stable aspect ratio for media to prevent layout shift, using the native CSS aspect-ratio property.
$ velocityx add aspect-ratio-box
Needs a licence key —
subscribe here, then
velocityx loginonce.
$ velocityx add aspect-ratio-box@1.0.0 Built for astro.
Full docs for Aspect-Ratio Media Box →
16/9
1/1
3/4
Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| as | 'div' | 'figure' | No | 'div' | |
| ratio | string | No | '16/9' | |
| rounded | boolean | No | true | |
| className | string | No | '' |
File this creates
The CLI writes this path into your project, relative to its root — nothing else moves.
components/velocity/aspect-ratio-box/AspectRatioBox.astro Using the Aspect-Ratio Media Box component
Install it with velocityx add aspect-ratio-box.
The CLI writes the source straight into your project — no runtime dependency, no registry
lock-in, and it themes itself from the same primary-*/accent-* scale as the rest of the library.
Related components
More from Bento & Layout.
Breakpoint-free responsive card grid using CSS grid auto-fit/minmax, column count is purely a function of container width.
astroSingle card shell component with five variants (icon, stat, image, chart-slot, quote) sharing one accessible article shell.
astroResponsive 4-cell bento grid, 1 column on phone and 2x2 on tablet/desktop, with four named slots.
astroFeature-led bento grid with one wide lead cell plus three supporting cells, built with CSS grid-template-areas.
astro