Mobile › Overlays

Dialog

Asks the person to confirm before something they can't undo. Up to three buttons.

Installation

npx expo install plankui-mobile react-native-safe-area-context expo-haptics

Usage

import { Dialog } from "plankui-mobile";

<Dialog
  open={open}
  onClose={() => setOpen(false)}
  title="Delete project?"
  message="This removes the project and its 12 screens. You can't undo this."
  buttons={[
    { label: "Cancel", style: "cancel" },
    { label: "Delete", style: "destructive", onPress: remove },
  ]}
/>

iOS and Android

iOS: A centred alert with stacked or side-by-side buttons, the cancel button bold.

Android: A Material 3 dialog with text buttons at the bottom right.

API reference

PropTypeDefaultDescription
openbooleanWhether it shows.
onClose() => voidCalled when it closes.
titlestringThe question.
messagestring–What will happen.
buttons{ label; onPress?; style?: "default" | "cancel" | "destructive" }[]Up to three. Put cancel first; it lands where each platform expects.