pub fn use_drop_with_options(
    node: NodeRef,
    options: UseDropOptions
) -> UseDropHandle
Expand description

This hook tracks file, link and copy-paste drops. use_drop hook with options.

Example

use yew_hooks::{use_drop_with_options, UseDropOptions};

#[function_component(UseDrop)]
fn drop() -> Html {
    let node = use_node_ref();
    let state = use_drop_with_options(node.clone(), UseDropOptions {
        onfiles: Some(Box::new(move |files, data_transfer| {
            // Process files or data_transfer
        })),
        ..Default::default()
    });

    html! {
        <div ref={node}>
            <p>
                { "Try to drag & drop or copy & paste something here, e.g. files, links or text" }
            </p>
        </div>
    }
}