<kern-file-input>
File picker with drop zone (firmware, configuration import), form-associated. Checks accept and max-size; rejected files are named in the message and not added. The chosen files are listed with size and ×; with multiple new files are added, otherwise they replace the previous one. The form gets the files under name.
Examples
Firmware upload
A drop zone with a button. accept and max-size are checked; rejected files are named in the message and not added. A new file replaces the previous one; × removes it. The form receives the file under name.
Several files
With multiple, new files are added to the list instead of replacing it. Set files = [] to clear the list from script.
Properties
acceptstring | undefined
Like the native attribute: .bin,.json, image/*, application/pdf.
disabledboolean
errorstring | undefined
filesFile[]
The chosen files; set [] to clear.
hintstring | undefined
labelstring | undefined
labelChoosestring | undefined
labelChooseMultiplestring | undefined
labelDropstring | undefined
labelRemovestring | undefined
{name} is replaced.
labelTooLargestring | undefined
{name} and {max} are replaced.
labelWrongTypestring | undefined
{name} is replaced.
localestring | undefined
BCP 47 locale for sizes; defaults to <html lang>, then the browser language.
maxSizenumber | string | undefined
Largest file, in bytes or as "16MB", "500KB".
multipleboolean
namestring | undefined
requiredboolean
Events
kernChangeCustomEvent<{ files: File[]; }>
When files were added or removed.
Methods
addFiles()addFiles(list: FileList | File[]) => Promise<void>
Check and add files (also used for drops).
open()open() => Promise<void>
Opens the file dialog.
CSS parts
dropzoneThe drop zone