Pular para o conteúdo

File Input

Este conteúdo não está disponível em sua língua ainda.

The FileInput component allows users to select files through drag-and-drop or a file browser.
It is fully accessible, supports multiple files, and can restrict accepted file types.

  • Drag-and-drop support: Users can drop files onto the component.
  • Multiple files: Select or drop more than one file at a time.
  • File type restrictions: Accept only certain types (images, PDFs, etc.) using the accept prop.
  • Customizable UI: You can embed icons, text, buttons, or any interactive element.
  • Reactive binding: Selected files can be tracked via state.

Drag and Drop

or


Prop / SlotTypeDefaultDescription
multiplebooleanfalseAllows selecting multiple files.
acceptstring""Comma-separated list of allowed file types (e.g., "image/*,.pdf").
onDropEventfunctionundefinedCallback triggered when files are selected or dropped. Receives the File[].
childrenOptionalCustom UI inside the FileInput (icons, text, buttons).
  • Use file type restrictions to prevent invalid uploads.
  • Provide visual feedback when files are dropped or selected.
  • Keep the UI simple and accessible, especially for drag-and-drop zones.
  • Combine with form validation to handle required files.
  • Use state tracking for managing multiple files efficiently.