File Upload

A component that is used to upload multiple files.

Preview Component

Please note, the API of this component is currently in a preview phase and is subject to change.

    Anatomy

    To set up the file upload component correctly, you’ll need to understand its anatomy and how we name its parts.

    Each part includes a data-part attribute to help identify them in the DOM.

    Examples

    Learn how to use the FileUpload component in your project. Let’s take a look at the most basic example:

    API Reference

    Item

    PropTypeDefault
    file
    File
    asChild
    boolean

    Root

    PropTypeDefault
    accept
    string | Record<string, string[]>
    allowDrop
    boolean
    asChild
    boolean
    dir
    'ltr' | 'rtl'"ltr"
    disabled
    boolean
    files
    File[]
    getRootNode
    () => ShadowRoot | Node | Document
    id
    string
    ids
    Partial<{ root: string dropzone: string hiddenInput: string trigger: string label: string item(id: string): string itemName(id: string): string itemSizeText(id: string): string itemPreview(id: string): string }>
    locale
    string"en-US"
    maxFiles
    number
    maxFileSize
    number
    minFileSize
    number
    name
    string
    onFileAccept
    (details: FileAcceptDetails) => void
    onFileReject
    (details: FileRejectDetails) => void
    onFilesChange
    (details: FileChangeDetails) => void
    translations
    IntlTranslations
    validate
    (file: File) => FileError[] | null

    Label

    PropTypeDefault
    asChild
    boolean

    Trigger

    PropTypeDefault
    asChild
    boolean

    Dropzone

    PropTypeDefault
    asChild
    boolean

    ItemName

    PropTypeDefault
    asChild
    boolean

    ItemGroup

    PropTypeDefault
    asChild
    boolean

    ItemPreview

    PropTypeDefault
    asChild
    boolean
    type
    string'.*'

    ItemSizeText

    PropTypeDefault
    asChild
    boolean

    ItemPreviewImage

    PropTypeDefault
    asChild
    boolean

    ItemDeleteTrigger

    PropTypeDefault
    asChild
    boolean