ImageCropper

The dropzone and crop surface on their own.

<ImageCropper.Root>
	<ImageCropper.Dropzone />
	<ImageCropper.Area />
</ImageCropper.Root>

The parts behind ImageUploadField, for when you need the crop step inside a dialog or a flow of your own. useImageCropper gives you the crop area and the zoom so you can drive them from your own controls.

API

ImageCropper.Root

PropTypeDefault
acceptstring"image/*"File input accept filter.
aspectRationumber1Width / height ratio of the crop viewport, e.g. 1 for avatars or 16 / 9 for covers.
crossOriginCrossOrigin"anonymous"CORS mode for remote image URLs — without it the export canvas is tainted and cropToBlob throws a SecurityError. Picked files load through blob: URLs and never need it.
defaultImagestringImage URL to start cropping without going through file selection.
disabledbooleanfalse
maxZoomnumber4
minZoomnumber1Lowest zoom level; 1 means the image exactly covers the viewport.
onCropChange((cropArea: ImageCropperCropArea) => void)Reports the crop rectangle in natural image pixels whenever it moves.
onImageChange((file: File | null) => void)Reports the picked file, or null when the image is removed.

Plus every <div> prop. Source: image-cropper/components/image-cropper-root.tsx.

ImageCropper.Area

PropTypeDefault
shape"circle" | "rectangle""rectangle"Visual mask drawn over the viewport; "circle" pairs with aspectRatio 1.

Plus every <div> prop. Source: image-cropper/components/image-cropper-area.tsx.

ImageCropper.Dropzone

PropTypeDefault
descriptionstring"Click to browse or drag and drop"
labelstring"Choose an image"

Plus every <div> prop. Source: image-cropper/components/image-cropper-dropzone.tsx.