Skip to main content

use_click_outside

Function use_click_outside 

Source
pub fn use_click_outside(
    target_element_id: ReadSignal<String>,
    on_click_outside: EventHandler<()>,
)
Expand description

Registers a document-level click listener and calls the handler when the click happens outside of the element with the provided id.

This is useful for dropdowns, popovers, and context menus that should close when focus moves away from their root element.