Documentation

Asgard

Getting started

Theming

Guides

Layout

Docking

Inputs & forms

Button

Switch

Checkbox

Radio

Select

Slider

TextBox

Upload

ImageCropper

Pickers

Color picker

Calendar

Time picker

DateTime input

Data display

Card

Accordion

Typography

Progress

DataTable

TreeView

SyntaxColor

MarkdownRenderer

Terminal

Layout & docking

Grid

Splitter

SDiv

Dock

Theme switcher

Media query

Feedback & overlays

Alert

Toast

Tooltip

Popups

Drawer

FloatingPanel

FloatingWindow

Navigation & chrome

Breadcrumb

Stepper

Toolbar

Ribbon

ContextMenu

FeatureTour

Documentation

Asgard

Getting started

Theming

Guides

Layout

Docking

Inputs & forms

Button

Switch

Checkbox

Radio

Select

Slider

TextBox

Upload

ImageCropper

Pickers

Color picker

Calendar

Time picker

DateTime input

Data display

Card

Accordion

Typography

Progress

DataTable

TreeView

SyntaxColor

MarkdownRenderer

Terminal

Layout & docking

Grid

Splitter

SDiv

Dock

Theme switcher

Media query

Feedback & overlays

Alert

Toast

Tooltip

Popups

Drawer

FloatingPanel

FloatingWindow

Navigation & chrome

Breadcrumb

Stepper

Toolbar

Ribbon

ContextMenu

FeatureTour

Inputs & forms

Crop, zoom and adjust an image on a canvas.

Canvas-based image cropping with interactive pan, zoom, rotation and a live crop overlay.

Key features:

  • cropShape: rectangle or circle (ideal for avatars)
  • Preset and free aspect ratios (1:1, 16:9, free, …)
  • Rotation, flipping and brightness / contrast adjustments
  • Undo / redo history and PNG / JPEG / WebP export
  • Imperative ref API (getCroppedImage, rotate90, undo, …)
Loading preview…
When to use it
  • Avatar and profile-photo editors
  • Thumbnail and banner generators
  • Any precise image selection before upload
Properties
PropTypeDefaultDescription
srcstring | File | HTMLImageElementImage to crop. Accepts a URL, a File, or an existing image element.
cropShape'rectangle' | 'circle''rectangle'Shape of the crop area. Circle is useful for profile photos.
aspectRatio'free' | '1:1' | '3:4' | '4:3' | '16:9' | '21:9' | '9:16' | 'custom''free'Locks the crop to a ratio. Use free for unconstrained cropping.
customAspectRationumberRatio used when aspectRatio is "custom".
showGridbooleanfalseShow a rule-of-thirds grid overlay to aid composition.
snapToGridbooleanfalseSnap the crop edges to a pixel grid while dragging.
gridSizenumber10Grid spacing in pixels used for snapping.
constrainToImagebooleanfalseKeep the crop region within the visible image bounds.
allowRotationbooleanfalseEnable rotation controls (free + 90° increments).
allowFlipbooleanfalseEnable horizontal and vertical flip controls.
showImageAdjustmentsbooleanfalseExpose brightness and contrast sliders.
enableHistorybooleanfalseEnable undo / redo across crop, transform and adjustment changes.
minZoomnumber0.1Minimum zoom factor.
maxZoomnumber5Maximum zoom factor.
initialZoomnumber1Zoom factor applied on load.
semantic'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info''primary'Accent color for the crop handles and border.
backgroundColorstring'#000000'Fill for the area outside the image.
exportTransparentbooleanfalseExport out-of-image areas as transparent (PNG only).
onCropChange(crop: CropArea) => voidFired continuously as the crop region changes.
onCropComplete(image: CroppedImageData) => voidFired with the cropped result after an export.
onZoomChange(zoom: number) => voidFired when the zoom factor changes.
onRotationChange(rotation: number) => voidFired when the rotation changes.
Notes
  • The ref exposes getCroppedImage, setZoom, setRotation, rotate90, flipHorizontal/Vertical, undo/redo, canUndo/canRedo and resetTransform.
  • getCroppedImage resolves with { blob, dataUrl, dimensions, cropArea }. Output formats are png, jpeg and webp.
  • enableHistory must be true for undo/redo to track crop, transform and adjustment changes.
  • The component reads the canvas on mount, so it renders client-side only (it is excluded from server rendering in this explorer).
Presets