Safe area
Keep content clear of the notch, the status bar and the home indicator. Lynx reads the same env(safe-area-inset-*) values that iOS Safari does.
The safe area is the part of the screen that hardware and system bars don't cover. On a recent iPhone, the notch or Dynamic Island covers the top edge, and the home indicator (the bar you swipe up) covers the bottom. On the web, a page with viewport-fit=cover pads itself with env(safe-area-inset-top) and its siblings. Lynx supports the same four values.
Pad with env()
- There are four values:
safe-area-inset-top,safe-area-inset-right,safe-area-inset-bottomandsafe-area-inset-left. - They work inside
calc(), as in.tab-barabove. - Where no inset is known, the value is 0. The padding collapses instead of breaking the layout.
Where the insets come from
Apps you build with ng build --platform ios or --platform android already keep the whole page inside the safe area. The native app places it below the status bar and above the home indicator, so you don't need inset padding there. If you add it anyway, check the result on a device.
Tailwind utilities
The Tailwind plugin that comes with the UI components, blotchPlugin, adds padding utilities built on env(). npx @blotch/dolan init copies it into your project.
The <n> takes any value from your spacing scale, as p-<n> does: pb-safe-8, pt-safe-2.
Check for a notch in TypeScript
Prefer CSS: env() adapts to every device without code. For logic CSS can't express, inject LynxSafeArea.
On iOS and Android, inject(LynxSafeArea) currently throws on the main thread. It reads Lynx's SystemInfo object, which the main thread doesn't have. Until that's fixed, use the CSS approach on devices.
isNotchScreen()is a signal that'struewhen the device has a notch or camera cutout. It comes from the host app (the native app that runs your bundle): Lynx Explorer passes it, and the apps thatng build --platformmakes don't, so there it's alwaysfalse.platformis the operating system. On phones it's'iOS','Android'or'Harmony', which is Huawei's HarmonyOS.SAFE_AREA_INSET_TOP,SAFE_AREA_INSET_RIGHT,SAFE_AREA_INSET_BOTTOMandSAFE_AREA_INSET_LEFTare theenv()strings, such as'env(safe-area-inset-top)', for building styles in TypeScript.
