v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS

ImageCropper

Adjust a rectangular crop and export it as PNG.

Interactive preview

Orbit geometric study
Crop area in percent

Usage

import { ImageCropper } from "@devvy-ui/react";

<ImageCropper src="/examples/orbit.svg" alt="Orbit study" onCrop={saveBlob} />

API reference

Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:

PropTypeDefaultDescription
src / altstringrequiredSource image and description.
onCrop(blob: Blob) => voidrequiredPNG output; caller owns saving/uploading.

Accessibility & behavior

Platform Behavior & Guidelines

Four named percentage sliders provide a keyboard alternative to drag cropping. Canvas export is explicit. Same-origin/CORS images are required; failures are reported without claiming success.

Source ownership

Run npx @devvy-ui/cli init once in your React project, then add the source:

npx @devvy-ui/cli add image-cropper

Make the source yours.

Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.

ImageCropper.tsxREACT / TSX

Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.