Config component is the central configuration hub for Uploadcare File Uploader. It accepts configuration options as HTML attributes or DOM properties and synchronizes them with the shared state across all components.
Overview
The Config component extendsLitBlock and provides a reactive configuration system. All configuration values can be set via:
- HTML attributes (kebab-case or lowercase)
- DOM properties (camelCase)
- JavaScript API
Basic Usage
Configuration via Properties
Core Properties
Upload Settings
Your Uploadcare public key. Required for the uploader to work.
Allow multiple file uploads.
Minimum number of files required.
Maximum number of files allowed.
Require manual confirmation before uploading files.
File Restrictions
Accept only image files.
Specify accepted file types (MIME types or extensions).
Maximum file size in bytes. 0 means no limit.
Upload Sources
Comma-separated list of available upload sources.Available sources:
local, url, camera, dropbox, gdrive, gphotos, instagram, facebook, onedrive, box, vk, evernote, flickr, unsplashCamera Settings
Mirror the camera preview.
Available camera modes (comma-separated).
Enable audio recording in video mode.
Maximum video recording duration in seconds.
null means no limit.Storage & CDN
File storage mode. Can be
'auto', '1' (store), or '0' (don’t store).Custom CDN CNAME for file delivery.
UI Settings
Lock body scroll when modal is open.
Show upload list even when empty.
Display mode for files. Can be
'list' or 'grid'.Localization
Locale code for UI text.
Advanced Settings
Enable debug mode with console logging.
Group uploaded files into a single CDN group.
Complex Properties
Some configuration options cannot be set as attributes and must be set via JavaScript properties:metadata
Custom metadata to attach to uploaded files.fileValidators
Array of custom validation functions for files.collectionValidators
Array of custom validation functions for the entire file collection.secureUploadsSignatureResolver
Function to resolve secure upload signatures.mediaRecorderOptions
Options for the MediaRecorder API when recording video.Context Sharing
Thectx-name attribute connects Config with other components:
ctx-name share the same configuration and state.
Attribute Mapping
Attributes can be written in different formats:- Kebab-case:
max-local-file-size-bytes="1000000" - Lowercase:
maxlocalfilesizebytes="1000000" - Property (camelCase):
element.maxLocalFileSizeBytes = 1000000
Reactive Updates
Configuration changes trigger automatic updates across the uploader:Source Code Reference
Implementation:/workspace/source/src/blocks/Config/Config.ts:55
Initial configuration values: /workspace/source/src/blocks/Config/initialConfig.ts:10
See Also
- UploadCtxProvider - Context provider for upload functionality
- DropArea - File drop zone component
- SourceList - Upload source selector