ImageUploadField

Drop an image, crop it, confirm it.

<ImageUploadField
	value={avatarUrl}
	onFileCropped={upload}
	onRemove={clear}
	shape="circle"
/>

shape="rectangle" with an aspectRatio covers a banner. onFileCropped receives the cropped file, so the upload stays yours.

API

PropTypeDefault
onFileCropped(blob: Blob) => voidrequiredFired with the cropped Blob once the user confirms — parent uploads it.
aspectRationumber1Crop aspect ratio: 1 for avatars, 3 for covers.
cancelLabelstring"Cancel"
confirmLabelstring"Save"
descriptionReactNode"Click to browse or drag and drop"
isUploadingbooleanfalseWhile true, the confirm button spins and a Progress bar shows.
labelReactNode"Upload an image"
onRemove(() => void)
outputSize{ readonly width: number; readonly height: number; }Fixed output dimensions for the cropped image (e.g. a 512×512 avatar). Defaults to the cropped region's natural size.
removeLabelReactNode"Remove"
replaceLabelReactNode"Replace"
shapeImageUploadShape"circle"
valuestring | nullCurrent image URL, or null/undefined when nothing is set yet.

Plus every <div> prop. Source: image-upload-field/components/image-upload-field.tsx.