Struct sycamore_dnd::DroppableBuilder
source · pub struct DroppableBuilder<'cx, G: Html, T: FromTransfer + 'static = ()> { /* private fields */ }Expand description
The builder for the create_droppable options
Implementations§
source§impl<'cx, G: Html, T: FromTransfer + 'static> DroppableBuilder<'cx, G, T>
impl<'cx, G: Html, T: FromTransfer + 'static> DroppableBuilder<'cx, G, T>
sourcepub fn on_drop(self, f: impl Fn(T) + 'cx) -> Self
pub fn on_drop(self, f: impl Fn(T) + 'cx) -> Self
Sets a callback to run when an item is dropped on this droppable element.
The argument is parsed from the item’s DataTransfer.
sourcepub fn accept(self, f: impl Fn(&T) -> bool + 'cx) -> Self
pub fn accept(self, f: impl Fn(&T) -> bool + 'cx) -> Self
A callback to check if the incoming DataTransfer should be accepted.
The argument is parsed from the item’s DataTransfer.
sourcepub fn hovering_class(self, class: impl Into<String>) -> Self
pub fn hovering_class(self, class: impl Into<String>) -> Self
A class or list of classes to set when a valid item is hovering over the element. They are automatically removed when the item leaves or is dropped.