Aspect Ratio
A box that keeps its shape.
Default
Sixteen by nine, at whatever width the column gives it.
16 / 9
Holds its contents to a ratio whatever the width. Use it around anything whose height would otherwise be decided after loading — a picture, a video, an embedded map — so the page does not jump when it arrives.
Installation
npx philcn@latest add aspect-ratioThe file is written into your project. It is yours from then on — change it as you like.
Props
| Prop | Type | What it does |
|---|---|---|
| AspectRatio.ratio | number | Width divided by height. Write it as a division — `16 / 9` — and read it later. |
Types are read from the library itself, so this table cannot describe an option the code no longer has. Everything else you pass goes straight to the underlying <div>.