Skip to main content

TreeNodeTarget

Function TreeNodeTarget 

Source
pub fn TreeNodeTarget<T: Clone + PartialEq + 'static>(
    _: TreeNodeTargetProps<T>,
) -> Element
Expand description

A single tree row that acts as a drop target with intent detection.

The payload type T travels through the shared DndContext<T> (use the core Draggable or PointerDraggable on your rows to start drags). While hovered, the wrapper carries data-intent="before" | "after" | "into" for styling insertion indicators — for native mouse drags, touch/pen drags, and keyboard drags alike.

Every target also registers itself in the shared zone registry, which is what makes it reachable by touch hit-testing and keyboard navigation. Keyboard drops land with Into intent (the row’s center band). At the registry level a target accepts a payload if your accepts passes for any intent; the exact intent is re-checked at drop time.

§Props

For details, see the props struct definition.

  • node : NodeId

    The node this row represents.

  • row_height : f64

    Height of the row in pixels, used for the before/into/after bands.

  • accepts : Option<Callback<(T,DropIntent),bool>>

    Reject drops (typically: cycle prevention). Receives (payload, intent).

  • on_drop : EventHandler<TreeDropEvent<T>>
  • label : Option<String>

    Announced to screen readers during keyboard navigation.

  • attributes : Vec<Attribute>
  • children : Element