safe-area-handling

Configure safe-area insets for Capacitor apps across iOS and Android.

Updated Dec 5, 2024
One-click install
npx skills add https://github.com/yeohj0710/wellnessbox --skill safe-area-handling-yeohj0710
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: safe-area-handling
Source: https://github.com/yeohj0710/wellnessbox/tree/main/.agents/skills/safe-area-handling
Command: npx skills add https://github.com/yeohj0710/wellnessbox --skill safe-area-handling-yeohj0710

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents content from being overlapped by notches, cameras, and Android cutouts by providing CSS, JS utilities, and native configurations for safe-area handling across devices.

Core Features & Use Cases

  • CSS viewport-fit and env() strategies to read and apply safe-area insets.
  • JavaScript utilities, React Hook, and Vue composables to adapt layouts to safe areas.
  • Native iOS and Android configurations to extend content to edges and support edge-to-edge UIs.

Quick Start

Enable viewport-fit=cover and use env(safe-area-inset-*) paddings to respect notches and home indicators.

Frequently Asked Questions about safe-area-handling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle safe-area insets for iPhone notches and Android cutouts in Capacitor apps?

To handle safe-area insets for notches and cutouts in Capacitor apps, enable viewport-fit=cover and apply env(safe-area-inset-*) CSS variables to pad your layout away from device hardware obstructions.

Does safe-area handling work with React and Vue layouts?

Yes, safe-area handling works with React and Vue by providing dedicated React Hooks and Vue composables that dynamically read and apply CSS environment variables to adapt component layouts.

What is the best way to implement edge-to-edge UIs in Capacitor without content being overlapped?

The best way to implement edge-to-edge UIs in Capacitor without overlap is configuring native iOS and Android settings to extend content to screen edges while applying env() CSS paddings.

Why does my content still overlap the Dynamic Island after applying standard CSS padding?

Content overlaps the Dynamic Island because standard CSS padding ignores hardware cutouts; you must set viewport-fit=cover in your HTML meta tag to activate env(safe-area-inset-*) variables.

Do I need native configurations to support home indicators on iOS and display cutouts on Android?

Yes, you need native iOS and Android configurations to extend web views fully across the screen, allowing your CSS env() variables to correctly detect and respect home indicators and display cutouts.