Image cropper (UI SDK): Avatar
With mode="frame", the selection stays still and you pan and zoom the image under it. shape="circle" rounds it, so pass shape: "circle" to cropImage as well.
This adds the example as components/examples/ui-sdk-image-cropper/avatar.tsx, together with the Image cropper component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/ui-sdk-image-cropper-avatar.jsonTo add only the component, follow the Image cropper installation.
Props in this example
The Image cropper props this example sets, from the API reference.
| Prop | Type | Default |
|---|---|---|
src | string | – |
cropThe crop in image pixels, with rotation, flipX and flipY. | ImageCrop | – |
onCropChange | (crop, details) => void | – |
mode | "box" | "frame" | "box" |
aspectRatio | number | – |
shape | "rectangle" | "circle" | "rectangle" |
maxZoom | number | 10 |
| Prop | Type | Default |
|---|---|---|
altRequired. | string | – |
Every prop is in the Image cropper API reference.
See them all, with keyboard support and accessibility notes, on the Image cropper page.