CropperPreview

Displays the current crop without creating a second cropper.

Props

PropTypeDefault
stateCropperState | nullnull
imageCropperImage | nullnull
transitionsCropperTransitions | nullnull
loadingbooleanfalse
loadedbooleantrue
classClassValueundefined
wrapperSnippet<[CropperPreviewWrapperSnippetProps]>CropperPreviewWrapper
boundarySnippet<[CropperPreviewBoundarySnippetProps]>StretchableBoundary
backgroundSnippet<[CropperPreviewBackgroundSnippetProps]>CropperPreviewBackground
crossOriginCrossOrigintrue
stylestringundefined
cropperCropperPreviewSource | nullundefined

Source and exports

CropperPreviewSource supplies getState(): CropperState | null, getImage(): CropperImage | null, getTransitions(): CropperTransitions | null, isLoading(): boolean and isLoaded(): boolean.

Source precedence is cropper, then the adapter installed with update, then the snapshot props. A source must be non-null to win. Reactive getters update the preview automatically.

Export on CropperPreviewInstanceBehavior
refresh(): voidRe-read the source and stretch the boundary, including nonreactive adapters.
update(cropper?: CropperPreviewSource | null): voidStore or clear the adapter and refresh.

Snippets and context

Preview snippets receive preview and, for the background, the fitted size. The default boundary uses stretchPreviewBoundary. Async results are ignored when superseded or destroyed. No cropper context is provided or required. There is no export method on a preview.

Selectors

.advanced-cropper-preview, __boundary, __content, __image and __image--visible identify the preview. The wrapper additionally emits .cropper-preview-wrapper and __fade. See styling.