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_preferred_contrast

Reactive prefers-contrast media query.

Usage

use leptos::prelude::*;
use leptos_use_preferences::use_preferred_contrast;

#[component]
fn Demo() -> impl IntoView {

let preferred_contrast = use_preferred_contrast();

   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 PreferredContrast::NoPreference.

See also

Installation

cargo add leptos-use-preferences

Types

Source

Source • Docs