FileUpload
Select and validate local files through a dropzone or trigger.
Use FileUpload to collect local files before the application sends them. Selection and validation happen in the component; upload transport belongs to the caller.
Basic usage#
Playground#
Anatomy#
Usage#
Selecting files#
Click anywhere in the visible dropzone, including its padding, icon, and text, or drop files onto it. File previews and removal actions are outside the picker hit area. Use the dropzone for pointer and drag-and-drop selection, or set dropzone={false} for a compact picker trigger. Use multiple when the value can contain more than one File; onValueChange receives either a single file, an array, or null.
Rejections and form behavior#
accept, minSize, maxSize, and maxFiles validate an attempted selection before it is added. Handle onFileReject to present rejected files and their reason codes in your application. readOnly prevents changes while preserving the selected list. It inherits an enclosing Field read-only state when omitted; an explicit readOnly={false} overrides that state. disabled also removes interaction.
Keyboard interaction#
| Key | Description |
|---|---|
| ↵ / Space | Opens the native operating system file picker dialog when the upload control is focused. |
| ⇥ | Navigates between the upload dropzone control and individual file removal buttons. |
Examples#
Multiple files#
File rejections#
Trigger-only picker#
Form integration#
Attributes#
data-disabledSlot: file-uploadDescription: Present when the component, slot, or item is disabled.data-invalidSlot: file-upload, file-upload-controlDescription: Present when the field or form has a validation error.data-readonlySlot: file-uploadDescription: Present when the field is in read-only mode.data-requiredSlot: file-uploadDescription: Present when the field input is required.data-dropzoneSlot: file-upload-control, file-upload-wrapperDescription: Present when the target is an active file dropzone.data-draggingSlot: file-upload-controlDescription: Present while the related thumb or handle is being dragged.Props#
Props for the FileUpload component. Renders a <div> element by default.