# Aspect Ratio > Keeps its content at a fixed width-to-height ratio. Source: https://shellui.dev/docs/v0.4/components/layout/aspect-ratio `AspectRatio` is **new in v0.4**. It takes the width of its parent and sets its height from `Ratio`, then stretches its child to fill it. Use it for images, video embeds, maps and placeholders that must not shift the layout while loading. ## Installation ```bash shellui add aspect-ratio ``` ## Usage ### Basic `Ratio` is width divided by height. It is a `double`, so write `16d / 9d`: `16 / 9` is integer division in C# and gives `1`. ```razor
16 : 9
``` ### Common ratios ```razor
1 : 1
4 : 3
21 : 9
``` ### Images The child is positioned to fill the box, so an image only needs `object-cover`. ```razor
Landscape illustration
@code { private const string Image = "data:image/svg+xml;utf8,"; } ``` ## API Reference | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | `Ratio` | `double` | `16d / 9d` | Width divided by height | | `ChildContent` | `RenderFragment?` | `null` | Content that fills the box | | `Class` | `string?` | `null` | Additional CSS classes | ## Accessibility - A plain container with no role of its own; give images inside it `alt` text