Skip to main content

BridgeDropZone

Function BridgeDropZone 

Source
pub fn BridgeDropZone<A: Clone + PartialEq + 'static, B: Clone + PartialEq + 'static>(
    _: BridgeDropZoneProps<A, B>,
) -> Element
Expand description

A drop target registered in two payload worlds at once - the bridge between two coexisting providers (DndProvider<A> and DndProvider<B>).

Zone ids are process-global while registries are per-type, so one element can hold the same ZoneId in both registries, sharing its mounted/rect signals. Each world’s machinery - hit-testing, accepts filtering, keyboard navigation - then finds the zone independently, and every drop arrives through its own typed callback: an A drag can only reach on_drop_a, a B drag only on_drop_b. No downcasts, no shared erased channel.

Reach for this only when two providers genuinely coexist (say, tickets and teammates as separate features). If one drag world merely carries several shapes, make the payload an enum and use a plain DropZone. For more than two worlds, register a shared id yourself with use_zone_registry - this component is that recipe, packaged for the common pair.

Styling hooks match DropZone: data-active="true" while an acceptable drag from either world is in flight, data-over="true" while one hovers this zone.

§Props

For details, see the props struct definition.

  • id : Option<ZoneId>

    Stable identity for this zone, valid in both worlds. Auto-generated if omitted.

  • label : Option<String>

    Human label for screen-reader announcements, used by both worlds.

  • accepts_a : Option<Callback<A,bool>>

    Return false to reject a payload from the first world.

  • accepts_b : Option<Callback<B,bool>>

    Return false to reject a payload from the second world.

  • on_drop_a : EventHandler<DropOutcome<A>>

    Fired when a drag from the first world drops here.

  • on_drop_b : EventHandler<DropOutcome<B>>

    Fired when a drag from the second world drops here.

  • attributes : Vec<Attribute>
  • children : Element