Skip to main content

DropZone

Function DropZone 

Source
pub fn DropZone<T: Clone + PartialEq + 'static>(_: DropZoneProps<T>) -> Element
Expand description

A region that accepts drags carrying T.

Handles the HTML5 boilerplate for you: preventDefault on dragover, enter/leave depth counting (so child elements don’t cause hover flicker), and acceptance filtering.

§Props

For details, see the props struct definition.

  • id : Option<ZoneId>

    Stable identity for this zone. Auto-generated if omitted.

  • label : Option<String>

    Human label for screen-reader announcements (“Over {label}”).

  • accepts : Option<Callback<T,bool>>

    Return false to reject a payload (zone won’t highlight or accept it).

  • on_drop : EventHandler<DropOutcome<T>>

    Fired on a successful drop.

  • on_enter : Option<EventHandler<T>>

    Fired when an acceptable drag first enters the zone.

  • on_leave : Option<EventHandler<()>>

    Fired when the drag leaves the zone (or drops).

  • attributes : Vec<Attribute>
  • children : Element