Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

use_document_visibility

Reactively track document.visibilityState

Demo

Usage

use leptos::prelude::*;
use leptos_use_document_visibility::use_document_visibility;

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

view! { }
}

Server-Side Rendering

Make sure you follow the instructions in Server-Side Rendering.

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

Installation

cargo add leptos-use-document-visibility

Source

Source • Demo • Docs