packages/core/useScreenOrientation/index.md
Reactive Screen Orientation API. It provides web developers with information about the user's current screen orientation.
import { useScreenOrientation } from '@vueuse/core'
const {
isSupported,
orientation,
angle,
lockOrientation,
unlockOrientation,
} = useScreenOrientation()
To lock the orientation, you can pass an OrientationLockType to the lockOrientation function:
import { useScreenOrientation } from '@vueuse/core'
const {
isSupported,
orientation,
angle,
lockOrientation,
unlockOrientation,
} = useScreenOrientation()
lockOrientation('portrait-primary')
and then unlock again, with the following:
import { useScreenOrientation } from '@vueuse/core'
const { unlockOrientation } = useScreenOrientation()
// ---cut---
unlockOrientation()
Accepted orientation types are one of "landscape-primary", "landscape-secondary", "portrait-primary", "portrait-secondary", "any", "landscape", "natural" and "portrait".