Skip to content
  • System
  • Light
  • Dark
  • High contrast

FileUpload

import { FileUploadField } from '@eekodigital/raster';

<FileUploadField label="Upload supporting document" name="document" />
PDF, DOCX or XLSX. Max 10 MB.
<FileUploadField
  label="Upload supporting document"
  name="document"
  hint="PDF, DOCX or XLSX. Max 10 MB."
/>
Error: Select a file to upload
<FileUploadField
  label="Upload supporting document"
  name="document"
  error="Select a file to upload"
/>

Restricting file types and multiple selection

Section titled “Restricting file types and multiple selection”

Use the native accept attribute to restrict file types, and multiple to allow more than one file at once.

JPG or PNG only.
<FileUploadField
  label="Upload images"
  name="images"
  hint="JPG or PNG only."
  accept="image/jpeg,image/png"
  multiple
/>
PropTypeDefaultDescription
labelstringVisible label for the file input.
hintstringOptional hint text below the label.
errorstringValidation error message.
…propsInputHTMLAttributes

All native <input type=“file”> attributes, including accept, multiple, disabled, and onChange.