Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/useScreenSafeArea.md
1---2category: Browser3---45# useScreenSafeArea67Reactive `env(safe-area-inset-*)`891011## Usage1213In order to make the page to be fully rendered in the screen, the additional attribute `viewport-fit=cover` within `viewport` meta tag must be set firstly, the viewport meta tag may look like this:1415```html16<meta name="viewport" content="initial-scale=1, viewport-fit=cover" />17```1819Then we could use `useScreenSafeArea` in the component as shown below:2021```ts22import { useScreenSafeArea } from '@vueuse/core'2324const {25top,26right,27bottom,28left,29} = useScreenSafeArea()30```3132For further details, you may refer to this documentation: [Designing Websites for iPhone X](https://webkit.org/blog/7929/designing-websites-for-iphone-x/)3334## Component Usage3536```vue37<template>38<UseScreenSafeArea top right bottom left>39content40</UseScreenSafeArea>41</template>42```4344## Type Declarations4546```ts47export interface UseScreenSafeAreaReturn {48top: ShallowRef<string>49right: ShallowRef<string>50bottom: ShallowRef<string>51left: ShallowRef<string>52update: () => void53}54/**55* Reactive `env(safe-area-inset-*)`56*57* @see https://vueuse.org/useScreenSafeArea58*/59export declare function useScreenSafeArea(): UseScreenSafeAreaReturn60```61