HextaUI

File input (UI SDK): Page-wide drop

With target="document" and variant="overlay", the zone covers the page while files are dragged over the window, and takes files dropped anywhere. A drop on another zone stays with that zone.

Drop files anywhere on this page.

import {
  FileInput,
  FileInputDropzone,
  FileInputDropzoneDescription,
  FileInputDropzoneIcon,
  FileInputDropzoneTitle,
  FileInputItem,
  FileInputList,
  FileInputTrigger,
} from "@/components/ui/ui-sdk-file-input"

function UiSdkFileInputPageDrop() {
  return (
    <FileInput multiple className="max-w-md">
      <div className="flex items-center justify-between gap-3">
        <p className="m-0 text-sm text-muted-foreground">
          Drop files anywhere on this page.
        </p>
        <FileInputTrigger>Upload files</FileInputTrigger>
      </div>
      <FileInputDropzone target="document" variant="overlay">
        <FileInputDropzoneIcon />
        <FileInputDropzoneTitle>Drop to attach</FileInputDropzoneTitle>
        <FileInputDropzoneDescription>
          Files land in the list below.
        </FileInputDropzoneDescription>
      </FileInputDropzone>
      <FileInputList aria-label="Attachments">
        <FileInputItem />
      </FileInputList>
    </FileInput>
  )
}

export { UiSdkFileInputPageDrop }

This adds the example as components/examples/ui-sdk-file-input/page-drop.tsx, together with the File input component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/ui-sdk-file-input-page-drop.json

To add only the component, follow the File input installation.

Props in this example

The File input props this example sets, from the API reference.

PropTypeDefault
multiple
booleanfalse
PropTypeDefault
variantA dashed zone, a card that wraps a message composer, or a full-page overlay shown while dragging.
"default" | "composer" | "overlay""default"
target
"element" | "document""element"

Every prop is in the File input API reference.

See them all, with keyboard support and accessibility notes, on the File input page.