HextaUI

Image cropper (UI SDK): Disabled

A disabled cropper can’t be focused or changed, and its zoom and buttons are disabled.

A rowing boat on a green mountain lake
import {
  ImageCropper,
  ImageCropperHandles,
  ImageCropperImage,
  ImageCropperRotate,
  ImageCropperSelection,
  ImageCropperViewport,
  ImageCropperZoom,
} from "@/components/ui/ui-sdk-image-cropper"

const photo =
  "https://images.unsplash.com/photo-1501785888041-af3ef285b470?w=1200&q=80&auto=format&fit=crop"

function UiSdkImageCropperDisabled() {
  return (
    <ImageCropper
      aria-label="Photo"
      src={photo}
      aspectRatio={16 / 9}
      disabled
      className="max-w-md"
    >
      <ImageCropperViewport>
        <ImageCropperImage alt="A rowing boat on a green mountain lake" />
        <ImageCropperSelection>
          <ImageCropperHandles />
        </ImageCropperSelection>
      </ImageCropperViewport>
      <div className="flex items-center gap-2">
        <ImageCropperZoom />
        <ImageCropperRotate />
      </div>
    </ImageCropper>
  )
}

export { UiSdkImageCropperDisabled }

This adds the example as components/examples/ui-sdk-image-cropper/disabled.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-disabled.json

To add only the component, follow the Image cropper installation.

Props in this example

The Image cropper props this example sets, from the API reference.

PropTypeDefault
src
string–
aspectRatio
number–
disabled
booleanfalse
PropTypeDefault
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.