Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Forms Form-associated

FileUpload <pm-file-upload>

File upload: drag-and-drop zone, file picker and paste (Ctrl/⌘+V on the focused zone), with type/size/count checks, image previews and a removable file list.

Full screen

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/file-upload'; </script> <pm-file-upload label="Attachments" accept="image/*,.pdf" multiple max-size="5242880" hint="PNG, JPG or PDF. You can also paste a screenshot."></pm-file-upload>

States

Each state is one attribute.

Disabled
Read-only
Required
Error

Overview

Show upload progress per file with setProgress(file, %) and setStatus(file, 'done' | 'error', message). capture opens the camera on phones. Form-associated: submits the chosen files under name.

Attributes

AttributeTypeDefaultDescription
namestring—Form field name: the files are submitted under it (default "files").
labelstring—Visible label (use hide-label to hide it visually).
hintstring—Help text under the drop zone, linked to it for screen readers.
errorstring—Custom error message (e.g. a server-side rejection). Setting it marks the field invalid.
acceptstring—Allowed types, like the native attribute: ".pdf,image/*".
multiplebooleanfalseAccept more than one file.
max-size
prop: maxSize
number—Maximum size per file, in bytes.
max-files
prop: maxFiles
number—Most files accepted when multiple is set.
disabledbooleanfalseNot interactive and not submitted.
requiredbooleanfalseThe form cannot be submitted until a file is chosen.
capture'user' | 'environment'—Phones: open the camera directly (user front, environment back).
hide-label
prop: hideLabel
booleanfalseHide the label visually; it stays the accessible name.
readonlybooleanfalseFocusable and submitted, but the user cannot change the value.

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Events

EventReact / Svelte propDescription
pm-changeonPmChangeFiles added or removed.
pm-rejectonPmRejectA file was refused: wrong type, too large, or more files than allowed.

Slots

SlotDescription
(default)Custom drop-zone text.

Methods

setProgress(), setStatus(), addFiles(), removeFile(), checkValidity(), reportValidity(), validate()