shadcn.io is not affiliated with official shadcn/ui
Framework
UI library
Radix UI does not include this primitive, so this page uses the Ark UI component. The visuals match the Ark UI version.
Installation
bunx --bun shadcn@latest add https://kit.dev/r/radix/image-cropper.jsonAnatomy
ImageCropper
├── ImageCropperViewport
├── ImageCropperImage
├── ImageCropperSelection
├── ImageCropperHandle
└── ImageCropperGridUsage
import {
ImageCropper,
ImageCropperImage,
ImageCropperSelection,
} from "@/components/ui/image-cropper";<ImageCropper className="aspect-video w-full max-w-lg">
<ImageCropperImage
alt="Crop me"
src="https://images.unsplash.com/photo-1662692735672-544412d65934?w=600&auto=format"
/>
<ImageCropperSelection />
</ImageCropper>Demos
Aspect Ratio
Circle Crop
Controlled Zoom
Fixed Crop Area
Initial Crop
Min Max Size
Zoom Limits
API Reference
ImageCropper
div
PropType
AttributeType
CSS variableType
--color-whitestring--crop-heightstring--crop-widthstring--crop-xstring--crop-ystring--image-offset-xstring--image-offset-ystring--image-rotationstring--image-zoomstringImageCropperViewport
div
PropType
AttributeType
CSS variableType
--color-whitestringImageCropperImage
img
PropType
AttributeType
ImageCropperSelection
div
PropType
AttributeType
CSS variableType
--cropper-accentstringImageCropperHandle
div
PropType
AttributeType
CSS variableType
--cropper-accentstring--cropper-handler-sizestring--cropper-handler-widthstringImageCropperGrid
div
PropType
AttributeType