A form control that lets the user select one or more files, or a folder.

Slots
prefix — Renders content before the input.
suffix — Renders content after the input.
helper-text — Renders content below the input.
file-selector-text — Renders content for the browse button.
file-missing-text — Renders content when no file is chosen.
value-missing — Renders content when the required validation fails.
custom-error — Renders content when a custom message is set with `setCustomValidity()`.
invalid — Renders content when the component is in invalid state (validity.valid = false).
CSS Parts
container — The main wrapper that holds all main input elements.
input — The native input element.
label — The native label element.
file-names — The file names wrapper.
file-selector-button — The browse button wrapper.
prefix — The prefix wrapper.
suffix — The suffix wrapper.
helper-text — The helper text wrapper.
prefixed — Added to the container and the input when an element that is not hidden is in the prefix slot.
suffixed — Added to the container and the input when an element that is not hidden is in the suffix slot.
filled — Added to the container and the input when the control has a value.
labelled — Added to the container in the material theme when the control has a label.
start — The wrapper of the prefix in the material theme.
notch — The wrapper of the label in the material theme.
filler — The outline segment between the notch and the end in the material theme.
end — The wrapper of the suffix in the material theme.
file-parts — The wrapper of the browse button and the file names.

The file types the control accepts, as a comma-separated list.

accept: string

Whether the control receives focus automatically.

autofocus: boolean

Whether the user selects a folder instead of files. The selection then holds every file in the folder and its subfolders, and the webkitRelativePath of each file gives its path from the folder.

directory: boolean

The label for the control.

label: string
locale: string

Whether the control allows the user to select more than one file.

multiple: boolean

Whether the control has an outlined appearance.

outlined: boolean

The placeholder text of the control.

placeholder: string
resourceStrings: TGet

The value of the control: the name of the first selected file, as the native file input gives it. As for the native file input, only an empty string can be set. It clears the selection.

value: string

The list of selected files.

get files(): FileList

Returns FileList

Removes focus from the control.

blur(): void

Returns void

Sets focus on the control.

focus(options: FocusOptions): void

Parameters

  • options: FocusOptions

Returns void

Selects all the text inside the input.

select(): void

Returns void

Emitted when the control's file picker dialog is canceled.

onCancel(args: CustomEvent<FileList>): void

Parameters

Returns void

Emitted when the selection of the control changes.

onChange(args: CustomEvent<FileList>): void

Parameters

Returns void