Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Shadcn Image Cropper for React and Tailwind

Crop and transform images.

Installation

bunx --bun shadcn@latest add https://kit.dev/r/image-cropper.json

Anatomy

ImageCropper
├── ImageCropperViewport
├── ImageCropperImage
├── ImageCropperSelection
├── ImageCropperHandle
└── ImageCropperGrid

Usage

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

ImageCropperViewport

div

PropType
CSS variableType

ImageCropperImage

img

PropType
AttributeType

ImageCropperSelection

div

PropType
AttributeType
CSS variableType

ImageCropperHandle

div

PropType
AttributeType
CSS variableType

ImageCropperGrid

div

PropType
AttributeType

useImageCropper