Layout
AspectRatio
Keeps media at a width-to-height ratio as it resizes.
Ant Design: -
import { AspectRatio } from '@alea/ui';
Examples
Ratios
16:9, 4:3 and square boxes that keep their shape as they resize.
16:9
4:3
1:1
Props
AspectRatio props
Keeps its content at a width-to-height ratio: videos, maps, images (Radix AspectRatio).
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | - | Extra class names for the root element. |
ratio | number | 16 | width / height, e.g. 16 / 9. Default 16 / 9. |
style | CSSProperties | - | Inline styles for the root element. |
Do and don't
Do
- Use it for embeds (video, maps) so the page doesn't jump while they load.
Don't
- Don't crop images that carry information.