Leptos-Use Guide

use_window_focus

Reactively track window focus with window.onfocus and window.onblur events.

Demo

Usage

use leptos::*;
use leptos_use::use_window_focus;

#[component]
fn Demo() -> impl IntoView {
let focused = use_window_focus();

view! { }
}

Server-Side Rendering

On the server this returns a Signal that is always true.

Source

SourceDemoDocs