File Upload

<esp-file-upload>

Used to upload files.

Attributes

<esp-file-upload> has the following attributes:

accept

accept has a default value of "*".

The accepted file types. For example, to allow JPEG, PNG, and WebP images:

image/jpeg, image/png, image/webp

choose-text

choose-text has a default value of "Choose File".

The text to display on the button.

multiple

multiple has a default value of false.

Allow multiple files to be selected.

Methods

<esp-file-upload> has the following methods:

finishedProcessingFiles

The files-selected event sets the file upload to a processing state. Call this method when you have finished processing the selected files to reset the file upload.

traverseToClosest

Traverse up the DOM tree to find the closest element that matches the selector. This method is aware of shadow DOM boundaries and will traverse through them to find the element.

CSS Properties

<esp-file-upload> has the following CSS properties:

--esp-field-background

Background color of the shared field shell. Defaults to var(--esp-color-layer-2).

--esp-field-border-color

Border color of the shared field shell. Defaults to var(--esp-color-border).

--esp-field-border-width

Border width of the shared field shell. Defaults to 1px.

--esp-field-text-color

Text color used inside the shared field shell. Defaults to var(--esp-color-text).

--esp-field-hover-bg

Hover background color of the shared field shell. Derived from --esp-field-background.

--esp-field-focus-bg

Focus background color of the shared field shell. Derived from --esp-field-background.

--esp-field-focus-shadow

Shadow color used for shared field focus treatment. Defaults to var(--esp-color-shadow).

Where does this show?