Components / Layout

SafeArea

SafeArea keeps native content clear of the notch, the status bar, and the home indicator. On web it's a Box — safe-area concerns are a device-shell problem, not a browser problem — so the same cross-platform code reads the same on both targets.

Loading playground…
Updated 3 days agoEdit on GitHubWeb & native

What it is

A platform-conditional wrapper. On web the implementation renders a regular Box; on native the component imported from @usemotif/react-native wraps React Native's SafeAreaView. Both accept the same prop set so cross-platform screens stay portable — you don't need a platform branch at the call site.

Install

SafeArea is exported from usemotif. No separate install.

example.tsx
import { SafeArea } from 'usemotif';

API

SafeArea

stable
function SafeArea(props: SafeAreaProps): JSX.Element
…BoxPropsBoxProps

Every prop Box accepts. Style props apply to the underlying Box on web and to the SafeAreaView wrapper on native.

Examples

Native screen root:

example.tsx
export function HomeScreen() {
return (
  <SafeArea flex={1} bg="$colors.surface.base">
    <Header />
    <ScrollView flex={1}>
      <Feed />
    </ScrollView>
    <TabBar />
  </SafeArea>
);
}

Cross-platform notes

On web SafeArea renders a regular Box. The CSS env(safe-area-inset-*) variables are not applied automatically — wire them yourself in the platform-shell layer if a web-target shell needs them. On native SafeArea wraps SafeAreaView from React Native; padding for the notch, the status bar, and the home indicator is applied by the runtime.