Cropper
Image Cropper
An image in a fixed frame that you drag to reposition and zoom with a slider or the wheel.
npx motionsnack add image-cropperCustomize
<ImageCropper />Props
25 properties
| Property | Type | Default | Description |
|---|---|---|---|
| value | { x: number; y: number; zoom: number } | - | Position and zoom (controlled). x and y run 0-100, 50 is centred. |
| defaultValue | { x: number; y: number; zoom: number } | { x: 50, y: 50, zoom: 1.2 } | Position and zoom at the start (uncontrolled). |
| onChange | (value: { x, y, zoom }) => void | - | Called when a drag ends, on a key press and on zoom changes. |
| labels | { area?, instructions?, zoomOut?, zoomIn?, zoom?, reset?, error? } | English | UI strings. |
| locale | string | 'en-US' | BCP 47 locale of the zoom percentage. |
| grid | boolean | - | Deprecated alias of showGrid. |
| slider | boolean | - | Deprecated alias of showSlider. |
| width | number | - | Deprecated, ignored: the root is max-w-sm. |
| radius | number | - | Deprecated, ignored: the frame is radius 12. |
| accent | string | - | Deprecated, ignored: the zoom slider is monochrome. |
| elasticity | number | - | Deprecated, ignored. |
| duration | number | - | Deprecated, ignored: the standard spring. |
| bounce | number | - | Deprecated, ignored. |
| className | string | '' | Extra classes on the root. |
| src | string | '/sections/motion-01.jpg' | Image to crop. Empty renders nothing. |
| alt | string | 'Photo being cropped' | Alternative text that describes the photo. |
| shape | 'circle' | 'rectangle' | 'circle' | Shape of the crop: the whole frame, or a circle with the rest dimmed. |
| aspectRatio | number | 1 | Width divided by height of the frame. |
| minZoom | number | 1 | Smallest zoom. 1 is the image just covering the frame. |
| maxZoom | number | 3 | Largest zoom. |
| showGrid | boolean | true | Rule-of-thirds guides while dragging. |
| showSlider | boolean | true | Zoom slider with zoom-out and zoom-in buttons under the frame. |
| showReset | boolean | true | Reset button after the zoom row. |
| wheelZoom | boolean | true | Zoom with the mouse wheel or a trackpad pinch over the frame. |
| disabled | boolean | false | Dims the cropper and blocks every interaction. |
About Image Cropper
An image cropper for avatars and cover photos: the picture sits in a frame with a fixed aspect ratio and the user drags it into place. Dragging past an edge is allowed with resistance, and on release the image eases back inside the bounds with a spring. A rule-of-thirds grid fades in while dragging and out again afterwards. Zoom comes from the slider, the plus and minus buttons, the mouse wheel or a trackpad pinch, always around the centre of the frame. The mask can be a rectangle or a circle with the surroundings dimmed, and onChange reports the position as x and y from 0 to 100 together with the zoom, so the result is independent of the rendered size.
What's included
- Drag to reposition with elastic edges
- Spring back inside the bounds on release
- Zoom by slider, buttons, wheel or pinch
- Rule-of-thirds grid while dragging
- Circle or rectangle mask, any aspect ratio
- Controlled or uncontrolled, onChange with x, y and zoom
- Keyboard arrows to move, plus and minus to zoom
- Type
- Animated React cropper component
- Library
- Components · Cropper
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-09-20
- Install