Skip to content

Overlays and System UI

These components coordinate with platform windows, keyboards, gestures and system chrome. Prefer them over emulating overlays with absolute-positioned views.

use Pam\Native\ModalAnimationType;
use Pam\Native\ModalPresentation;
use Pam\Native\UI\Modal;
$modal = Modal::make(
$dialog,
visible: $this->state->showDialog,
presentation: ModalPresentation::Dialog,
)
->animationType(ModalAnimationType::Fade)
->backdropColor(0x99000000)
->hardwareAccelerated()
->onRequestClose(fn () => $this->state->showDialog = false)
->onDismiss(fn () => $this->afterDismiss());

Presentations are FullScreen, Dialog and Sheet. Animation types are None, Slide, Fade and SlideFade, which fades the backdrop while the content slides up. Always handle onRequestClose so Android Back closes the modal.

use Pam\Native\BottomSheetKeyboardBehavior;
use Pam\Native\UI\BottomSheet;
$sheet = BottomSheet::make(
$filters,
snapPoints: [0.35, 0.7, 1],
index: 1,
)
->dismissible()
->backdropDismiss()
->handleVisible()
->dragEnabled()
->cornerRadius(24)
->keyboardBehavior(BottomSheetKeyboardBehavior::Interactive)
->onChange(fn ($event) => $this->state->sheetIndex = $event->index)
->onDismiss(fn () => $this->state->filtersOpen = false);
<BottomSheet
:snapPoints="[0.35, 0.7, 1.0]"
index="1"
keyboardBehavior="interactive"
on:sheetChange="sheetChanged"
on:sheetDismiss="sheetDismissed"
>
<Filters />
</BottomSheet>

Keyboard behaviors are Interactive, Extend, FillParent and Contain. Interactive keeps the detent and moves the sheet with the keyboard so a bottom composer stays visible. Contain keeps the sheet’s position and publishes the keyboard inset to its content, so a KeyboardAvoidingView inside the sheet lifts a composer while the list above it shrinks.

A sheet without snap points fits its content, adds the part of the bottom inset the content does not already clear, and caps itself at the available height:

$menu = BottomSheet::make($menuItems, [])->handleVisible()->backdropDismiss();
<BottomSheet snapPoints="content">
<MenuItems />
</BottomSheet>

Prefer it for menus and pickers whose content can grow; a fixed detent that is too short clips the last rows. Content taller than the screen must scroll, so put a ScrollView or VirtualizedList with flexGrow inside the sheet.

Each Modal and BottomSheet is its own window. Its content is kept out of the status bar, navigation bar, gesture handle and home indicator by default: the engine pads the content container by max(inset, authored padding), so you do not need SafeAreaView or manual safeAreaBottom padding, and existing padding is not doubled. The sheet’s background still reaches the bottom of the screen. A SafeAreaView you add inside a modal receives that window’s insets, never the activity’s; see Safe Areas.

Removing a presented sheet or modal from the tree (for example with p-if="$open") plays the same exit animation as visible = false. PHP state already closed it, so no on:sheetDismiss, on:dismiss or on:requestClose event is sent for that exit, and touches reach the screen below at once.

<BottomSheet p-if="$filtersOpen" snapPoints="content" on:sheetDismiss="filtersDismissed">
<Filters />
</BottomSheet>

Keep on:sheetDismiss to synchronize state when the user swipes the sheet away. A closed sheet that stays mounted keeps its content alive; unmount sheets you rarely open so their images and lists are released.

use Pam\Native\ActivityIndicatorSize;
use Pam\Native\KeyboardAvoidingBehavior;
use Pam\Native\StatusBarAppearance;
use Pam\Native\UI\ActivityIndicator;
use Pam\Native\UI\KeyboardAvoidingView;
use Pam\Native\UI\StatusBar;
$loading = ActivityIndicator::make($this->state->loading)
->size(ActivityIndicatorSize::Large)
->color(0xFF2563EB)
->hidesWhenStopped();
$status = StatusBar::make(
color: 0xFFF8FAFC,
appearance: StatusBarAppearance::Dark,
)->animated();
$form = KeyboardAvoidingView::make(
$fields,
KeyboardAvoidingBehavior::Resize,
)->verticalOffset(12);

Templates may use either PAM’s color/appearance names or the familiar mobile aliases:

<StatusBar
backgroundColor="#F8FAFC"
barStyle="dark-content"
animated="true"
translucent="false"
/>

light-content selects light system icons; dark-content selects dark icons. The aliases compile to the same typed status-bar properties and are not passed through as inert view background styles. On Android, only the active retained stack route contributes status-bar configuration. Hidden screens cannot override the visible route when a stack is restored or when the user pushes, pops, replaces, or cancels an interactive back gesture.

DrawerLayoutAndroid supports overlay, front, back and permanent/adaptive drawer presentations with open/close events (install the optional pushinbr/pam-native-drawer plugin to use it). InputAccessoryView hosts native keyboard accessory content. Their names are retained for platform clarity; verify the target-specific behavior before depending on exact cross-platform appearance.