PWA UIv0.1 beta
Docs / Components / SafeArea

Component

SafeArea

SafeArea applies only the requested platform insets. It gracefully resolves to zero in ordinary browser tabs and never relies on model-specific device detection.

Preview

Content stays clearInsets are applied on every requested edge.
topbottom

Installation

bash
pnpm dlx shadcn@latest add https://pwaui.com/r/safe-area.json

Usage

tsx
import { SafeArea } from "@/components/ui/safe-area"
export function Footer() {  return (    <SafeArea edges={["left", "right", "bottom"]}>      <nav>...</nav>    </SafeArea>  )}

Anatomy

SafeArea

Composition

See how PWAProvider, AppShell, SafeArea, NavigationBar, and TabBar divide viewport, scrolling, safe-area, and navigation responsibilities.

Read the app layout guide →

Behavior notes

  • Supported edges: top, right, bottom, and left.
  • Uses env(safe-area-inset-*) with zero-value fallbacks.
  • Combine it with your own spacing inside a nested child when padding must be additive.

Platform limitations

  • env(safe-area-inset-*) only reports non-zero values when the page sets viewport-fit=cover on a device with display cutouts or an installed/edge-to-edge surface. Everywhere else these resolve to 0 by design.

Accessibility

SafeArea is a layout-only div and does not alter the semantics of its children.