‮Skip to content‬
uiify

File upload

‮Drop zone + file list.‬

‮Browsers‬
Chrome 123+Firefox 121+Safari 17.5+
‮Tier‬
1
‮Bundle compressed‬
2.27 kB
‮Forced layout budget‬
0 ms
‮Axe budget‬
0
‮SSR compatible‬
‮Yes‬
‮Published contract‬
‮Test harness‬

‮Playground‬

File upload

Attachments

Drop files here, or choose files above.

    Up to 3 files · 5 MB each

    ‮API‬

    FileUpload.Root

    ‮Prop‬‮Type‬‮Default‬‮Description‬
    childrenReactNode—‮File upload parts: hidden input, trigger, dropzone and list.‬
    valuereadonly File[]—‮Current files, making the component controlled.‬
    defaultValuereadonly File[][]‮Starting files for the uncontrolled component.‬
    onValueChange(files: File[]) => void—‮Called with the accepted files whenever the selection changes.‬
    onReject(rejections: FileRejection[]) => void—‮Called with the files that failed validation and why.‬
    acceptstring[][]‮Accepted file types, as extensions or MIME types.‬
    maxFilesnumber—‮Largest number of files that can be held at once.‬
    maxSizenumber—‮Largest accepted file size in bytes.‬
    minSizenumber—‮Smallest accepted file size in bytes.‬
    multiplebooleanfalse‮Lets the picker select more than one file.‬
    disabledbooleanfalse‮Disables the picker, the dropzone and the remove buttons.‬

    FileUpload.HiddenInput

    ‮Prop‬‮Type‬‮Default‬‮Description‬
    classNamestring—‮Class applied to the native file input.‬

    FileUpload.Trigger

    ‮Prop‬‮Type‬‮Default‬‮Description‬
    childrenReactNode—‮Content of the control that opens the file picker.‬
    classNamestring—‮Class applied to the trigger element.‬
    renderReactElement | ((props, state) => ReactElement)—‮Replace the rendered element while keeping behavior and accessibility wiring.‬

    FileUpload.Dropzone

    ‮Prop‬‮Type‬‮Default‬‮Description‬
    childrenReactNode—‮Content of the drop target.‬
    classNamestring—‮Class applied to the dropzone element.‬
    renderReactElement | ((props, state) => ReactElement)—‮Replace the rendered element while keeping behavior and accessibility wiring.‬

    FileUpload.List

    ‮Prop‬‮Type‬‮Default‬‮Description‬
    childrenReactNode | ((files: readonly File[]) => ReactNode)—‮Render accepted files from the live list. Controlled value changes and external resets are reflected immediately.‬
    classNamestring—‮Class applied to the list element.‬

    FileUpload.Item

    ‮Prop‬‮Type‬‮Default‬‮Description‬
    childrenReactNode—‮Content describing the file, such as its name and size.‬
    classNamestring—‮Class applied to the item element.‬
    index*number—‮Position of the file this item represents.‬
    renderReactElement | ((props, state) => ReactElement)—‮Replace the rendered element while keeping behavior and accessibility wiring.‬

    FileUpload.ItemRemove

    ‮Prop‬‮Type‬‮Default‬‮Description‬
    classNamestring—‮Class applied to the remove button.‬
    index*number—‮Position of the file this button removes.‬

    FileRejection

    ‮Prop‬‮Type‬‮Default‬‮Description‬
    file*File—‮The file that was not accepted.‬
    reason*"accept" | "max-size" | "max-files"—‮Which rule the file failed.‬

    ‮Keyboard‬

    ‮Key‬‮Action‬
    Enter / Space‮Open the file picker from Trigger or remove a focused file‬
    Tab‮Move between the picker trigger and file removal controls‬

    ‮Accessibility‬

    ‮Give HiddenInput an accessible label. List receives the accepted files and renders their names, sizes and labeled removal buttons. Root supports controlled value, cumulative maxFiles, maxSize and accept validation; onReject reports rejected files. Disabled roots block picker, drop and removal actions. File handling requires hydration.‬

    ‮Styling hooks‬

    data-uiify-file-uploaddata-partdata-disableddata-state