use_screen_orientation
Reactive Screen Orientation API. It provides web developers with information about the user's current screen orientation.
Demo
Usage
use leptos::prelude::*;
use leptos_use::{use_screen_orientation, UseScreenOrientationReturn};
#[component]
fn Demo() -> impl IntoView {
let UseScreenOrientationReturn { orientation, angle, lock_orientation, unlock_orientation } = use_screen_orientation();
view! { }
}
Server-Side Rendering
Make sure you follow the instructions in Server-Side Rendering.
On the server orientation will always be ScreenOrientation::PortraitPrimary and angle will always be 0.
The locking functions will be no-ops.
Feature
This function is only available if the crate feature
use_screen_orientationis enabled