···11+---
22+title: ImageCropper
33+description: A composable, headless React component for interactive image cropping with zoom, pan, and aspect ratio control.
44+---
55+66+import { PropDocs } from '../../../lib/PropDocs'
77+import { Example } from '../../../lib/Example'
88+import { Basic } from '../../../examples/image-cropper/basic'
99+import { DialogExample } from '../../../examples/image-cropper/dialog'
1010+1111+<Example src={Basic} />
1212+1313+## Installation
1414+1515+Run the following command to add the image-cropper component to your project.
1616+1717+```bash
1818+pnpm hip install image-cropper
1919+```
2020+2121+## Props
2222+2323+<PropDocs components={["ImageCropperRoot", "ImageCropperImage", "ImageCropperCropArea", "ImageCropperDescription"]} />
2424+2525+## Example
2626+2727+### In a Dialog
2828+2929+<Example src={DialogExample} />
3030+3131+## Features
3232+3333+### Interactive Cropping
3434+3535+The ImageCropper component provides a fully interactive cropping experience:
3636+3737+- **Zoom**: Use mouse wheel or pinch gestures to zoom in/out
3838+- **Pan**: Drag with mouse or touch to move the image
3939+- **Keyboard Navigation**: Use arrow keys to pan the image
4040+- **Aspect Ratio**: Enforce a specific aspect ratio for the crop area
4141+- **Controlled/Uncontrolled**: Manage zoom state internally or control it via props
4242+4343+### Crop Data
4444+4545+The `onCropChange` callback provides precise pixel coordinates of the cropped area relative to the original image:
4646+4747+```typescript
4848+type CropArea = {
4949+ x: number; // X coordinate of top-left corner
5050+ y: number; // Y coordinate of top-left corner
5151+ width: number; // Width of cropped area
5252+ height: number; // Height of cropped area
5353+}
5454+```
5555+5656+### Accessibility
5757+5858+The ImageCropper component is designed with accessibility in mind:
5959+6060+- **Required Description**: The `ImageCropper.Description` component is required for screen reader users
6161+- **ARIA Attributes**: Automatically includes proper ARIA attributes
6262+- **Keyboard Support**: Full keyboard navigation support
6363+6464+## Related Components
6565+6666+- [AspectRatio](/docs/components/content/aspect-ratio) - For maintaining aspect ratios in layouts
6767+- [Card](/docs/components/content/card) - For grouping content in containers
6868+