Extension Points
The registry API is the main extension point. Call its methods from inside setup to add capabilities to the uploader.
registerSource
Adds an entry to the source picker (the list of upload origins users can choose from).
registerActivity
Registers a custom UI panel rendered inside the uploader. Activities are identified by id and rendered on demand via uploaderApi.setCurrentActivity.
The render function receives:
Return a cleanup function (or nothing) from render. It is called when the activity unmounts.
The render function receives a plain HTMLElement host, so you can use any library or framework to render your activity UI — React, Vue, Svelte, or vanilla DOM. Just mount into host and unmount in the returned cleanup function.
TypeScript: declaring a custom activity
Augment the CustomActivities interface so setCurrentActivity is typed:
Use never for the params type if your activity takes no parameters.
registerFileAction
Adds a per-file action button to the file list (e.g. “Edit image”).
OutputFileEntry is described in the API reference.
File actions from plugins appear to the left of the built-in remove button, in the order their plugins were registered.
registerFileHook
Intercepts files at defined lifecycle points so you can transform them before the uploader continues processing.
The handler context contains:
After a hook returns a different file, the uploader recalculates derived metadata such as file size, MIME type, image detection, and file name.
'onAdd' runs right after a file enters the uploader collection. Use it for light normalization that should happen as early as possible.
'beforeUpload' runs right before the file is sent to the Uploadcare API. This is the better place for heavier async work such as resizing, compression, or format conversion.
If a hook does not resolve within its timeout (default 30 seconds), the uploader skips it and continues with the original file. A timed-out hook is logged via debugPrint but does not block the upload.
The helper functions in the examples below, such as detectMimeFromBytes and resizeImage, are illustrative placeholders. They are not provided by the uploader, so you need to implement them in your own code.
Multiple hooks of the same type are chained in registration order. Each handler receives the output of the previous one.
registerConfig
Declares a custom config option that becomes available on <uc-config> as a property (and optionally as an HTML attribute).
Non-string config options
Use fromAttribute and normalize when the config value is not a plain string:
TypeScript: declaring a custom config key
Augment the CustomConfig interface so pluginApi.config.get and .subscribe are typed: