datui
Color scheme

Forms

DropZone

Drag-and-drop target that highlights while files are dragged over it.

import { DropZone, DropZoneGrid } from "datui";

Examples

Drop or browse

With onFiles the zone also opens the file dialog on click, Enter or Space.

Drop images or press to browse
Drop target only

No files yet

Accessibility

  • With onFiles the zone is role="button", focusable, and Enter/Space/click open the file dialog; give it aria-label.
  • Without onFiles it is a pure drop target: pair it with File so keyboard users can add files.
  • Announce results yourself, e.g. with an aria-live region.

API

DropZone

Drop target that highlights while files are dragged over it.

PropTypeDefaultDescription
acceptstring—File types for the dialog (with `onFiles`).
childrenReactNode | ((state: { active: boolean; }) => ReactNode)—Content, or a render function receiving the drag-over state.
classNamestring—
disabledboolean—
multipleboolean—Allow several files (with `onFiles`).
onFiles((files: File[]) => void)—Makes the zone a button that opens the file dialog on click / Enter / Space, and receives dropped files. Without it the zone is a pure drop target (pair it with `File` for keyboard users).

DropZoneGrid

Lays out several DropZones.

PropTypeDefaultDescription
classNamestring—
direction"row" | "column"row`row` places zones side by side from the tablet breakpoint (stacked below it).