Leptos-Use Guide

use_document_visibility

Reactively track document.visibilityState

Demo

Usage

use leptos::*;
use leptos_use::use_document_visibility;

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

view! { }
}

Server-Side Rendering

On the server this returns a Signal that always contains the value web_sys::VisibilityState::Hidden.

Feature

This function is only available if the crate feature use_document_visibility is enabled

Source

SourceDemoDocs