Elements

Reference

Image Cropper

ImageCropper, dressed in the paper-and-ink system: a rounded vessel holding the photograph, one lit selection window framed by light hairlines. The parts — Root, Viewport, Image, Selection, Handle, Grid, Context.

Root · Viewport · Image · Selection · Handle · Grid

#Grid

PropTypeDefaultDescription
axis"horizontal" | "vertical"The axis of the grid lines to display

#Handle

PropTypeDefaultDescription
positionHandlePositionThe position of the handle

#Image

A styled part — no props of its own; it takes the anatomy's shared styling.

#Root

PropTypeDefaultDescription
aspectRationumberThe aspect ratio to maintain for the crop area (width / height). For example, an aspect ratio of 16 / 9 will maintain a width to height ratio of 16:9. If not provided, the crop area can be freely resized.
cropShape'rectangle' | 'circle'"rectangle"The shape of the crop area.
defaultFlipimageCropper.FlipState{ horizontal: false, vertical: false }The initial flip state to apply to the image.
defaultRotationnumber0The initial rotation to apply to the image in degrees.
defaultZoomnumber1The initial zoom factor to apply to the image.
fixedCropAreabooleanfalseWhether the crop area is fixed in size and position.
flipimageCropper.FlipStateThe controlled flip state of the image.
idsimageCropper.ElementIdsThe ids of the image cropper elements
initialCropRectThe initial rectangle of the crop area. If not provided, a smart default will be computed based on viewport size and aspect ratio.
maxHeightnumberInfinityThe maximum height of the crop area
maxWidthnumberInfinityThe maximum width of the crop area
maxZoomnumber5The maximum zoom factor allowed.
minHeightnumber40The minimum height of the crop area
minWidthnumber40The minimum width of the crop area
minZoomnumber1The minimum zoom factor allowed.
nudgeStepnumber1The base nudge step for keyboard arrow keys (in pixels).
nudgeStepCtrlnumber50The nudge step when Ctrl/Cmd key is held (in pixels).
nudgeStepShiftnumber10The nudge step when Shift key is held (in pixels).
rotationnumberThe controlled rotation of the image in degrees (0 - 360).
translationsimageCropper.IntlTranslationsSpecifies the localized strings that identify accessibility elements and their states.
zoomnumberThe controlled zoom level of the image.
zoomSensitivitynumber2Controls how responsive pinch-to-zoom is.
zoomStepnumber0.1The amount of zoom applied per wheel step.
EventPayload
zoomChangedetails: ZoomChangeDetails
update:zoomzoom: number
rotationChangedetails: RotationChangeDetails
update:rotationrotation: number
flipChangedetails: FlipChangeDetails
update:flipflip: FlipState
cropChangedetails: CropChangeDetails
update:cropcrop: Rect

#Selection

A styled part — no props of its own; it takes the anatomy's shared styling.

#Viewport

A styled part — no props of its own; it takes the anatomy's shared styling.