Leptos-Use Guide

use_device_orientation

Reactive DeviceOrientationEvent.

Provide web developers with information from the physical orientation of the device running the web page.

Demo

Usage

use leptos::prelude::*;
use leptos_use::{use_device_orientation, UseDeviceOrientationReturn};

#[component]
fn Demo() -> impl IntoView {
let UseDeviceOrientationReturn {
    is_supported,
    absolute,
    alpha,
    beta,
    gamma,
} = use_device_orientation();

view! { }
}

Server-Side Rendering

On the server this function returns values as if the orientation capabilties were not supported by the device.

Feature

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

Types

Source

SourceDemoDocs