Skip to main content

query

Function query 

Source
pub fn query(id: &str) -> Option<ElementHandle>
Expand description

Query an element by ID from event handlers

This is the primary way to access elements programmatically from within event handler closures. It uses the global BlincContextState to access the element registry.

Returns Some(ElementHandle) if the element exists, None otherwise.

§Example

use blinc_layout::selector::query;

div().on_click(|_| {
    if let Some(handle) = query("my-element") {
        handle.scroll_into_view();
        handle.focus();
    }
})