Aspect Crop, animated React component
An aspect-ratio picker whose crop frame keeps the same area at every ratio, so switching reads as re-cropping the same photo. The frame springs to its new shape and rule-of-thirds lines flash while it moves.
- Pro
- Inputs & Controls
- Spring
Play with it
Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| ratios | AspectRatioOption[] | DEFAULT_ASPECT_RATIOS | Ratios to offer, each { id, w, h } (4:3, 1:1, 3:4 and 9:16 by default). |
| src | string | — | Photo to crop. Without it a drawn sunset illustration is shown. |
| alt | string | "" | Alt text for src. |
| onChange | (id: string) => void | — | Called with the ratio id when the user picks one. |
| autoplay | boolean | false | Cycles through the ratios until someone touches it. |