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>| Prop | Type | Default | Description |
|---|---|---|---|
| src | string | Blob | — | The picture: a URL or a file (a Blob from a Dropzone). No src: the empty state. |
| cross | "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). |
| fixed | boolean | — | The crop stays fixed and the picture moves under it. Default: true for a circle. |
| aspect | string | — | The aspect: free, original, or a ratio text ("16:9"). Controlled with onAspectChange. |
| default | string | — | |
| on | — | ||
| zoom | number | — | The zoom, 1 = the base fit. Controlled with onZoomChange (called when a change settles). |
| default | number | — | |
| on | — | ||
| rotation | number | — | The turn in degrees (quarter turns plus the fine straighten). |
| default | number | — | |
| on | — | ||
| flip | — | ||
| default | — | ||
| on | — | ||
| on | — | The crop in natural pixels, 120ms after each change stops. | |
| on | — | ||
| min | number | 1 | Default 1 and 4. |
| max | number | 4 | |
| disabled | boolean | false | No input, 50%, no handles. |
| read | boolean | false | The 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. | |
| children | ReactNode | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
ImageCropperViewport
<fieldset>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <fieldset> attributes | — | Every other attribute goes to the <fieldset>, with a ref. |
ImageCropperEmpty
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
ImageCropperImage
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | The classes of the <img>. |
| decoding | "async""auto""sync" | — | |
| fetch | "auto""high""low" | — | |
| referrer | """no-referrer""no-referrer-when-downgrade""origin""origin-when-cross-origin""same-origin""strict-origin""strict-origin-when-cross-origin""unsafe-url" | — | |
| alt | string | "" | 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>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
ImageCropperGrid
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
ImageCropperHandle
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| position | "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>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
ImageCropperRotateSlider
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| on | — | The value at the end of a drag (after the flick), a key press, or a reset. | |
| on | — | true from the press until a flick stops: a host can show a grid while the ruler moves. | |
| step | number | — | The value grid and the arrow-key step. Default 1. |
| large | number | — | Shift + arrow and Page Up or Down. Default 10 steps. |
| tick | number | — | The value of one tick (6px). Default: step. |
| major | number | — | A major (long) tick each this many ticks, counted from 0. Default 5. |
| origin | number | "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. |
| reset | number | — | The value of a reset. Default: defaultValue, else the origin. |
| labels | boolean | ((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. |
| label | number | — | 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" | — | |
| format | NumberFormatOptions | — | The number format of the value, the labels, and aria-valuetext. |
| locale | LocalesArgument | — | |
| invalid | boolean | — | Shown as invalid (an invalid Field around it does the same). |
| name | string | — | |
| form | string | — | |
| aria-label | string | — | The name of the slider when there is no RulerSliderLabel. |
| get | — | The spoken value. Default: the formatted value. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
ImageCropperRotateButton
<button>| Prop | Type | Default | Description | ||||
|---|---|---|---|---|---|---|---|
| class | string | — | |||||
| busy | boolean | — | 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. | ||||
| spinner | "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" | — | |||||
| by | -9090 | — | −90 turns counterclockwise, 90 clockwise, in both text directions. | ||||
From Base UIButtonBase UI docs | |||||||
| focusable | boolean | false | Whether 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>| Prop | Type | Default | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||
| 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" | — | |||||||||||||||||||
| axis | "x""y" | — | x flips left and right, y up and down. | ||||||||||||||||||
From Base UIToggleBase UI docs | |||||||||||||||||||||
| default | boolean | false | Whether the toggle button is currently pressed. This is the uncontrolled counterpart of pressed. | ||||||||||||||||||
| disabled | boolean | false | Whether the component should ignore user interaction. | ||||||||||||||||||
| value | string | — | 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>| Prop | Type | Default | Description | ||||
|---|---|---|---|---|---|---|---|
| class | string | — | |||||
| busy | boolean | — | 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. | ||||
| spinner | "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 | |||||||
| focusable | boolean | false | Whether 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>| Prop | Type | Default | Description | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||||||||||
| full | boolean | — | |||||||||||||||||||||||||||
| orientation | "horizontal""vertical" | — | |||||||||||||||||||||||||||
| rounded | "default""full" | — | |||||||||||||||||||||||||||
| size | "default""lg""sm""xs" | — | |||||||||||||||||||||||||||
| presets | readonly string[] | ASPECT_RATIO_PRESETS | The ratio texts after Free and Original. Default: ASPECT_RATIO_PRESETS. | ||||||||||||||||||||||||||
From Base UIRadioGroupBase UI docs | |||||||||||||||||||||||||||||
| disabled | boolean | false | Whether the component should ignore user interaction. | ||||||||||||||||||||||||||
| read | boolean | false | Whether the user should be unable to select a different radio button in the group. | ||||||||||||||||||||||||||
| required | boolean | false | Whether the user must choose a value before submitting a form. | ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | ||||||||||||||||||||||||||
| Arrow keys | Crop box: moves the picture 1px. With Shift, it moves 10px. |
|---|---|
| Altarrow keys | Crop 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 keys | Handle: moves the corner or edge 1px. With Shift, it moves 10px. |
| HomeorEnd | Handle: moves the corner or edge to its minimum or maximum. |
| Arrow keys | ImageCropperRotateSlider: changes the turn by 0.1°. With Shift, it changes by 1°. |
| Delete | ImageCropperRotateSlider: resets the turn. |
Built with
Installs with Image Cropper
- Components
- Ruler Slider,Button,Segmented Control,Slider,Spinner,Toggle









