Skip to content

Image Cropper

Pro

Pick the part of a picture to keep: 8 handles or a fixed circle, zoom, straighten, turns, flips, aspect presets, and full keyboard support.

  • Base UI
  • Motion
  • React 19
  • Tailwind CSS 4

Added Nov 15, 2026 · Pro license

Playground

Loading the preview

Props

Needs your Pro API key in GELATIN_UI_PRO_TOKEN. Set it up

Pro itemAPI key required

Image Cropper needs a Pro API key

Try the live preview for free. With Pro, the add command above puts the source in your project.

Files it adds
61
More Pro items, one API key
+327
Your coding agent runs it
1 cmd

$79$129once, for life

Already have Pro? Sign in to set up your API key.

Give ImageCropperViewport a height. A host with no CORS header fails to load, so pass crossOrigin={null} if you only show the picture.

photo-crop.tsx

ImageCropper

<div>
PropTypeDefaultDescription
srcstring | Blob—The picture: a URL or a file (a Blob from a Dropzone). No src: the empty state.
crossOrigin"anonymous""use-credentials"null"anonymous"The CORS mode of the <img>. anonymous (default) keeps a picture from a CDN with CORS headers readable, so the export works; a host with no CORS header then fails to load (the error state). null loads with no CORS mode: a picture from any host shows, and only the export fails with a clear message (the canvas is tainted).
variant"circle""rect""rect"rect (default) or circle (an avatar; the aspect is 1:1).
fixedCropAreaboolean—The crop stays fixed and the picture moves under it. Default: true for a circle.
aspectstring—The aspect: free, original, or a ratio text ("16:9"). Controlled with onAspectChange.
defaultAspectstring—
onAspectChange—
zoomnumber—The zoom, 1 = the base fit. Controlled with onZoomChange (called when a change settles).
defaultZoomnumber—
onZoomChange—
rotationnumber—The turn in degrees (quarter turns plus the fine straighten).
defaultRotationnumber—
onRotationChange—
flip—
defaultFlip—
onFlipChange—
onCropChange—The crop in natural pixels, 120ms after each change stops.
onStatusChange—
minZoomnumber1Default 1 and 4.
maxZoomnumber4
disabledbooleanfalseNo input, 50%, no handles.
readOnlybooleanfalseThe crop shows (a preview, a save in progress) but nothing moves; the area stays focusable.
size"default""lg""sm""default"The size of the control row: 28, 32 (default), or 36px buttons; 44px on touch.
labels—Every text; keep the object stable.
childrenReactNode—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

ImageCropperViewport

<fieldset>
PropTypeDefaultDescription
...props<fieldset> attributes—Every other attribute goes to the <fieldset>, with a ref.

ImageCropperEmpty

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

ImageCropperImage

<div>
PropTypeDefaultDescription
classNamestring—The classes of the <img>.
decoding"async""auto""sync"—
fetchPriority"auto""high""low"—
referrerPolicy"""no-referrer""no-referrer-when-downgrade""origin""origin-when-cross-origin""same-origin""strict-origin""strict-origin-when-cross-origin""unsafe-url"—
altstring""The text of the picture; default "", because the viewport group already names the task.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

ImageCropperArea

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

ImageCropperGrid

<span>
PropTypeDefaultDescription
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

ImageCropperHandle

<span>
PropTypeDefaultDescription
positionRequired"bottom""bottomLeft""bottomRight""left""right""top""topLeft""topRight"—Which corner or edge it moves.
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

ImageCropperZoomSlider

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

ImageCropperRotateSlider

<div>
PropTypeDefaultDescription
onValueCommitted—The value at the end of a drag (after the flick), a key press, or a reset.
onMovingChange—true from the press until a flick stops: a host can show a grid while the ruler moves.
stepnumber—The value grid and the arrow-key step. Default 1.
largeStepnumber—Shift + arrow and Page Up or Down. Default 10 steps.
tickStepnumber—The value of one tick (6px). Default: step.
majorEverynumber—A major (long) tick each this many ticks, counted from 0. Default 5.
originnumber | "center" | "start"—The value with the dot, where a drag holds for 6px: center (0, kept inside the range), a number, or start (no dot; the span grows from min). Default center.
resetValuenumber—The value of a reset. Default: defaultValue, else the origin.
labelsboolean | ((value: number) => string)—Numbers on the ticks: true (the formatted value), or a function. Not on vertical. The arc is made for up to 250 ticks: past half a turn of its circle the ticks overlap.
labelEverynumber—A label each this many ticks. Default majorEvery × 2.
variant"arc""straight""vertical"—straight (default), arc (a curved ruler), or vertical (higher values up).
size"default""lg""sm"—
formatNumberFormatOptions—The number format of the value, the labels, and aria-valuetext.
localeLocalesArgument—
invalidboolean—Shown as invalid (an invalid Field around it does the same).
namestring—
formstring—
aria-labelstring—The name of the slider when there is no RulerSliderLabel.
getAriaValueText—The spoken value. Default: the formatted value.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

ImageCropperRotateButton

<button>
PropTypeDefaultDescription
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
glass"clear""dark""light"—
rounded"default""full"—
size"default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs"—
variant"dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary"—
byRequired-9090—−90 turns counterclockwise, 90 clockwise, in both text directions.
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

ImageCropperFlipButton

<button>
PropTypeDefaultDescription
classNamestring—
variant"default""outline"—default: no rest fill. outline: the field surface with an edge.
size"default""lg""sm""xs"—Height 24, 28, 32, or 36px.
rounded"default""full"—
axisRequired"x""y"—x flips left and right, y up and down.
From Base UIToggleBase UI docs
defaultPressedbooleanfalseWhether the toggle button is currently pressed. This is the uncontrolled counterpart of pressed.
disabledbooleanfalseWhether the component should ignore user interaction.
valuestring—A unique string that identifies the toggle when used inside a toggle group.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

ImageCropperReset

<button>
PropTypeDefaultDescription
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
glass"clear""dark""light"—
rounded"default""full"—
size"default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs"—
variant"dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary"—
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

ImageCropperAspectGroup

<div>
PropTypeDefaultDescription
classNamestring—
fullWidthboolean—
orientation"horizontal""vertical"—
rounded"default""full"—
size"default""lg""sm""xs"—
presetsreadonly string[]ASPECT_RATIO_PRESETSThe ratio texts after Free and Original. Default: ASPECT_RATIO_PRESETS.
From Base UIRadioGroupBase UI docs
disabledbooleanfalseWhether the component should ignore user interaction.
readOnlybooleanfalseWhether the user should be unable to select a different radio button in the group.
requiredbooleanfalseWhether the user must choose a value before submitting a form.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Use it to let people pick the part of a picture to keep.
  • Use variant="circle" for an avatar. The aspect is then 1:1.
  • Use ImageCropperAspectGroup when people choose the ratio, or set aspect to "16:9".
  • Use ImageCropperRotateSlider to straighten a photo, and ImageCropperRotateButton for 90° turns.
  • Use readOnly to show the crop during a save.
  • To only show a picture, use an Image.
  • To add files with no crop, use a Dropzone.
Arrow keysCrop box: moves the picture 1px. With Shift, it moves 10px.
Altarrow keysCrop box: resizes the crop from its center. Right and Up grow it; Left and Down shrink it. This needs free handles.
+or-Crop box: zooms by 0.1×.
[or]Crop box: turns the picture by 90°.
Arrow keysHandle: moves the corner or edge 1px. With Shift, it moves 10px.
HomeorEndHandle: moves the corner or edge to its minimum or maximum.
Arrow keysImageCropperRotateSlider: changes the turn by 0.1°. With Shift, it changes by 1°.
DeleteImageCropperRotateSlider: resets the turn.

The crop area and each handle take focus. The arrow keys move or resize the crop.

Zoom and straighten are real sliders, and each control has a name from labels.

Translate the names with the labels prop, and keep that object stable.

Press
press · 100ms · ease-out (0, 0, 0.2, 1)
Grid
fade · 150ms · ease-out (0, 0, 0.2, 1) · the grid shows during a change

Built with

Installs with Image Cropper

  1. AddedImage Cropper, with Ruler Slider, Button, Segmented Control, Slider, Spinner, Toggle.
Open the release