Upload
Drag-and-drop file selection with validation, upload progress, retry, cancellation, and attachment results.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
multiple | boolean | false | Accept several files in one browse or drop operation. |
variant | UploadVariant | dropzone | Dropzone provides drag-and-drop; compact renders only an upload button. |
accept | string | — | Comma-separated MIME types or file extensions, using the native file-input syntax. |
max-files | number | 0 | Maximum number of queued files. Zero means unlimited. |
max-size | number | 0 | Maximum size of each file in bytes. Zero means unlimited. |
auto-upload | boolean | true | Run uploadHandler immediately after files are accepted. |
disabled | boolean | false | Disables browsing, dropping and attachment actions. |
required | boolean | false | Requires at least one selected file for native form validation. |
name | string | — | Form field name. Each queued file is appended with this name. |
aria-label | string | null | null | Accessible name for the drop zone. |
Slots
| Name | Description |
|---|---|
drop-icon | Replaces the upload-cloud icon in the drop zone. |
prompt | Replaces the main drop-zone instruction. |
hint | Replaces the accepted-type and size hint. |
action | Replaces the dynamic label of the compact upload button. |
empty | Optional content shown below the drop zone while no files are selected. |
Events
| Name | Type | Description |
|---|---|---|
input | Event | Fired whenever the file value changes, for form and framework bindings. |
change | Event | Fired whenever files are added or removed, for form and framework bindings. |
files-selected | CustomEvent<UploadFilesEventDetail> | Fired after valid files enter the queue through browse, drop or addFiles(). |
file-reject | CustomEvent<{ rejections: UploadRejection[] }> | Fired when type, size, count or single-file rules reject files. |
upload-start | CustomEvent<{ item: UploadItem }> | Fired when an item begins uploading. |
upload-progress | CustomEvent<UploadProgressEventDetail> | Fired when the upload handler reports progress. |
upload-success | CustomEvent<UploadResultEventDetail> | Fired after an upload handler resolves; item.result contains its result. |
upload-error | CustomEvent<UploadResultEventDetail> | Fired after an upload handler rejects; item.error contains the error. |
upload-remove | CustomEvent<{ item: UploadItem }> | Fired after an item is removed or an active upload is cancelled. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
dropzone | Interactive drop-zone region containing the icon, prompt, and hint. |
drop-icon | Icon boundary wrapping the drop-icon slot and fallback icon. |
prompt | Instruction region wrapping the prompt slot and fallback prompt. |
hint | Supporting-text region wrapping the hint slot and generated fallback hint. |
action | Compact picker label boundary wrapping the action slot and fallback label. |
empty | Empty-state boundary exposing the empty slot. |
errors | Validation-error status region. |
list | Selected-file list region. |
CSS custom properties
Grouped by semantic target and state from --c2-component__target__state--property. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-upload--width | pixel | 420px | |
--c2-upload__dropzone--padding | padding | 28px 20px | |
--c2-upload__dropzone--gap | pixel | 8px | |
--c2-upload__dropzone--background | color | #ffffff | |
--c2-upload__dropzone--border | border | 1px dashed #bcbcc6 | |
--c2-upload__dropzone--border-radius | border-radius | 14px | |
--c2-upload__dropzone__hover--background | color | #fafafa | |
--c2-upload__dropzone__hover--border | border | 1px dashed #a1a1aa | |
--c2-upload__dropzone__drag--background | color | #e8f2ff | |
--c2-upload__dropzone__drag--border | border | 1px dashed rgb(2, 101, 220) | |
--c2-upload__dropzone__focus--outline | outline | 2px solid rgba(2, 101, 220, 0.4) | |
--c2-upload__dropzone__focus--outline-offset | pixel | 2px | |
--c2-upload__dropzone__disabled--opacity | opacity | 0.38 | |
--c2-upload__icon--size | pixel | 32px | |
--c2-upload__icon--color | color | rgb(2, 101, 220) | |
--c2-upload__prompt--color | color | #18181b | |
--c2-upload__prompt--font-size | font-size | 14px | |
--c2-upload__prompt--font-weight | font-weight | 600 | |
--c2-upload__action--color | color | rgb(2, 101, 220) | |
--c2-upload__hint--color | color | #71717a | |
--c2-upload__hint--font-size | font-size | 12px | |
--c2-upload__list--gap | pixel | 10px | |
--c2-upload__list--margin-top | pixel | 12px | |
--c2-upload__error--color | color | #dc2626 | |
--c2-upload__error--font-size | font-size | 12px | |
--c2-upload__error--gap | pixel | 4px | |