Skip to main content

FileDropZone

Function FileDropZone 

Source
pub fn FileDropZone(_: FileDropZoneProps) -> Element
Expand description

A zone that accepts files dragged in from the operating system.

Independent of DndContext - file drops don’t come from inside your app, so no provider is required.

While a drag hovers the zone the div carries data-over="true" (absent otherwise), so the classic “highlight the dropzone” style needs no on_hover wiring: Tailwind data-over:border-blue-500, CSS [data-over].

§Props

For details, see the props struct definition.

  • filter : Option<FileFilter>

    Acceptance rules; everything is accepted when omitted.

  • on_files : EventHandler<FileDrop>

    Fired with the accepted files of a drop (only if at least one passed).

  • on_rejected : Option<EventHandler<Vec<(FileData,FileRejection)>>>

    Fired with the rejected files of a drop, if any.

  • on_hover : Option<EventHandler<bool>>

    Fired with true when a drag hovers the zone, false when it leaves.

  • attributes : Vec<Attribute>
  • children : Element