A file picker that allows users to browse for or drag and drop files.
fileTypes
), maximum file size (maxFileSize
), and the maximum number of files that can be uploaded (maxFiles
).tctChange
event.invalidFiles
and validFiles
.invalidFiles
is an array of objects describing each file that did not meet the upload requirements. You can ignore this property or use it for logging purposes.validFiles
is an array of File (https://developer.mozilla.org/en-US/docs/Web/API/File) objects that met the upload requirements.tctChange
event is fired, upload the files in the validateFiles
array.FileStatus
object (inside an array) to the file picker's status
property.FileStatus
object has the following properties:name
: The name of the file.status
: The file upload status, either "failed"
or "uploaded"
.message
: An optional property for providing a custom status message. This is only applied if status
is "failed"
, and is intended to allow developers to give more details on upload failures.status
property updates the associated file item displayed below the picker button or drop zone—this hides the loading spinner and shows a status icon."failed"
or "uploaded"
, the spinner displayed in the file picker button or drop zone will disappear.FileStatus
object for each file in the array passed to status
.The q2-file-picker
element has multiple slots that can be used to insert custom content into the component.
An optional slot to display a custom description.
An optional slot to display a custom label.
The q2-file-picker
element has one or more properties that support text localization. Those properties are indicated by the localizable badge in the description.
buttonSize
button-size
The size of the browse button.
description
A description of the field. This is announced by screen readers when the field is focused.
fileTypes
file-types
Allowed file types based on extensions (e.g., ['jpg', 'png', 'pdf'] or 'jpg, png, pdf'). When using the attribute, provide a comma-separated string (e.g., 'jpg, png, pdf'). Arrays can only be set programmatically via JavaScript.
label
The label for the field. This is announced by screen readers when the field is focused.
maxFileSize
max-file-size
The maximum size (in bytes) of any file that can be selected.
maxFiles
max-files
The maximum number of files that can be selected.
status
An array of ValidFileStatus
objects representing the upload status of
files. Each ValidFileStatus
object contains the following properties:
name
: The file name.status
: The upload status, either "failed"
or "uploaded"
.message
: (Optional) A custom status message, used only when status
is "failed"
. This allows developers to provide more detail about
upload failures while ensuring all other file status messages remain
consistent with approved design/UX standards. Custom failure messages
are limited to a single line.value
Returns an object representing the selected files with two properties:
invalidFiles
: An array of InvalidFileStatus
objects representing
files that failed validation.validFiles
: An array of File
objects representing files that passed
validation.Each InvalidFileStatus
object includes the following properties:
file
: The File
object.status
: The validation status, which can be "invalid-type"
(invalid file
type), "over-size-limit"
(file exceeds the size limit), or
"over-max-files-limit"
(total exceeds the max files limit).variant
Determines if the file picker is a browse button or a drop zone with a browse link.
The q2-file-picker
element exposes events that can be used to send and receive data from the component based on user interaction.
Custom event dispatched when the user selects files. The event detail contains an object representing the selected files with two properties:
invalidFiles
: An array of InvalidFileStatus
objects representing
files that failed validation.validFiles
: An array of File
objects representing files that passed
validation.Each InvalidFileStatus
object includes the following properties:
file
: The File
object.status
: The validation status, which can be "invalid-type"
(invalid file
type), "over-size-limit"
(file exceeds the size limit), or
"over-max-files-limit"
(total exceeds the max files limit).{ invalidFiles: InvalidFileStatus[]; validFiles: File[]; }
The following CSS variables are available to override the default theme styles of the q2-file-picker
component.
Many Tecton components consume other components to maintain visual and functional consistency. If you are looking for a CSS variable you think should exist but are not seeing it, it may be defined in one of the dependent components below. Either way, if you think it's something we should expose more conveniently, let us know!
There is 1 frequently asked question related to this page.