Use arrow keys to pan (hold Shift for 10x larger steps), plus and minus or bracket keys to zoom, R to rotate, and Enter to apply crop.
100%

Keyboard

↑↓←→
Pan, hold Shift for larger steps
][
Zoom in or out
R
Rotate 90°
Enter
Apply the crop

The CLI also installs the npm packages and registry items it builds on, and reads the style in your components.json to pick the Base UI or Radix build.

image-cropper-usage.tsx
"use client"

import { useState } from "react"
import { ImageCropper } from "@/components/ui/image-cropper"

export function AvatarUpload() {
  const [blob, setBlob] = useState<Blob | null>(null)

  return (
    <ImageCropper
      src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=1200"
      aspect={1}
      cropShape="round"
      onCropComplete={(croppedBlob) => setBlob(croppedBlob)}
    />
  )
}

ImageCropper

An image cropping widget supporting pan, zoom, rotation, fixed aspect ratios, and Blob export.

Prop
srcRequiredstring | File | BlobSource image URL, File, or Blob.
aspectnumber | nullDefault1Aspect ratio (width / height) such as 1 (square), 16/9 (widescreen), or 4/3 (photo).
cropShape"rect" | "round"Default"rect"Visual mask overlay shape. round displays a circular mask for avatars.
zoomnumberControlled zoom scale.
defaultZoomnumberDefault1Initial zoom scale when uncontrolled.
onZoomChange(zoom: number) => voidCalled when zoom scale changes.
minZoomnumberDefault1Minimum zoom scale.
maxZoomnumberDefault3Maximum zoom scale.
rotationnumberControlled rotation angle in degrees.
defaultRotationnumberDefault0Initial rotation angle in degrees.
onRotationChange(rotation: number) => voidCalled when rotation angle changes.
cropPointControlled pan offset { x, y } in pixels.
defaultCropPointDefault{ x: 0, y: 0 }Initial pan offset.
onCropChange(crop: Point) => voidCalled when pan offset changes.
onCropComplete(blob: Blob, pixelCrop: PixelCrop) => voidCalled with the cropped image Blob and natural pixel crop dimensions when Apply is clicked or Enter is pressed.
onCropError(error: Error) => voidCalled when image loading or canvas export fails.
outputType"image/png" | "image/jpeg" | "image/webp"Default"image/png"MIME type for the generated Blob.
outputQualitynumberDefault0.92Quality setting (0 to 1) for lossy formats.
showControlsbooleanDefaulttrueShow zoom slider and rotate buttons below canvas.
showGridbooleanDefaulttrueShow rule-of-thirds grid inside crop area.
disabledbooleanDisables pan, zoom, and rotate interactions.

Other props go to the <div>.

Avatar circular crop

Square 1:1 aspect ratio with a circular mask overlay for user profile photos.

Use arrow keys to pan (hold Shift for 10x larger steps), plus and minus or bracket keys to zoom, R to rotate, and Enter to apply crop.
100%

16:9 cover banner

Widescreen 16:9 aspect ratio for profile covers and article headers.

Use arrow keys to pan (hold Shift for 10x larger steps), plus and minus or bracket keys to zoom, R to rotate, and Enter to apply crop.
100%

4:3 landscape framing

Standard 4:3 photo aspect ratio for photography and card assets.

Use arrow keys to pan (hold Shift for 10x larger steps), plus and minus or bracket keys to zoom, R to rotate, and Enter to apply crop.
100%
components/ui/image-cropper.tsx
CtrlK