<CldUploadWidget />
Configuration

CldUploadWidget Configuration

General Props

Prop NameTypeExample
childrenfunction{ (options) => {} }
optionsobject{ encryption: {...} }
signatureEndpointstring"/api/sign-cloudinary-params.js"
uploadPresetstring"my-upload-preset"

Event Props

Prop NameTypeExample
onErrorfunction(error, widget) => { }
onOpenfunction(widget) => { }
onUploadfunction(result, widget) => { }
onAbortfunction(result, options) => { }
onBatchCancelledfunction(result, options) => { }
onClosefunction(widget) => { }
onDisplayChangedfunction(result, options) => { }
onPublicIdfunction(result, options) => { }
onQueuesEndfunction(result, options) => { }
onQueuesStartfunction(result, options) => { }
onRetryfunction(result, options) => { }
onShowCompletedfunction(result, options) => { }
onSourceChangedfunction(result, options) => { }
onSuccessfunction(result, options) => { }
onTagsfunction(result, options) => { }
onUploadAddedfunction(result, options) => { }

To learn more about the event callbacks and when they trigger, see: https://cloudinary.com/documentation/upload_widget_reference#events (opens in a new tab)

Callback Options

Most of the callbacks provide a set of options that give access to the widget instance and allow more interaction.

Future releases will work to create a more consistent interface between older methods and more recently added methods.

NameTypeDescription
widgetWidgetThe widget instance attached to the current component.
[Instance Methods]functionSee below.

Composing Widget UI

CldUploadWidget uses Function as a Child component to pass options to the widget UI.

To make this work, use a function as the direct child of a CldWidget Instance:

<CldUploadWidget>
  {({ cloudinary, widget, open }) => {
    // UI
  }}
</CldUploadWidget>

The first and only argument is an object that contains instances of cloudinary, the widget, various instance methods that can control the widget, and other data.

Child Function Options

By passing in a function as the child of the Upload Widget, you're able to gain access to the widget, results, and instance methods to interface directly with the widget.

NameTypeDescription
cloudinaryCloudinaryThe Cloudinary instance which creates and manages the Widget instance.
errorstringThe error, if any, produced by an upload widget action.
isLoadingbooleanDesignates whether the upload widget is loading and initializing.
resultsobjectThe event that triggered the results and information related to that event, which can include upload results.
widgetWidgetThe widget instance attached to the current component.
[Instance Methods]functionSee below.

Instance Methods

NameTypeDescription
closefunctionCloses and resets the widget to its initial state without removing it from memory.
destroyfunctionHides a previously rendered widget while retaining its current state in memory.
hidePromiseCloses the widget and completely removes it from the DOM. Returns a promise that resolves upon cleanup completion.
isDestroyedfunctionReturns whether the destroy method was called on this instance.
isMinimizedfunctionReturns whether the widget is currently minimized.
isShowingfunctionReturns whether the widget is currently visible.
minimizefunctionMinimizes the widget.
openfunctionRenders an existing widget currently in memory, but that is not currently displayed.
showfunctionRenders a previously hidden widget.
updatefunctionUpdates a widget currently in memory with new options.