Dialog

An alert that asks for a decision: a title or a message alone, up to three actions and an optional field.

import { Dialog } from "@plexui/react-native"

For a sheet use Bottom Sheet, for a choice of actions Action Sheet.

Examples

Overview

Platforms

iOS 26Android
Native componentAlertDialog
LookGlass panel with capsule actionsA white (night: dark gray) panel with 21dp corners, text buttons in the accent at the end

iOS calls its sheets dialogs too; for a sheet use Bottom Sheet.

API

Dialog

PropTypeDefaultDescription
openboolean—Shows the dialog (required)
onOpenChange(open: boolean) => void—Called with false when an action, a tap outside or Back closes it (required)
titleReactNode—The title. Without one the dialog is its message alone: an iOS alert with only a message, Material 3's supporting text alone
descriptionReactNode—The message under the title, or the whole text of a dialog without one
imageReactNode—A picture that leads the text (an app's icon): on iOS 60 across in its rounded square at the start, the text in a column 12 beside it, the actions under both; on Android over the text, at the start
actionsDialogAction[][]The actions; two stand side by side on iOS, three or more stack
childrenReactNode—Content between the text and the actions, as a text field
mobileLayout"inline" | "stacked"—stacked stacks the actions and inline keeps them in a row, on iOS and Android. By default on iOS two stand side by side while their labels fit on one line, else they stack, and three or more stack; on Android the buttons stand in a row while they fit, else they stack
actionColor"accent" | "primary""accent"The preferred action's color: the accent, or the primary (the text color, black in light, as a brand without a tint does)
dismissiblebooleantrue on Android, false on iOSA tap outside, Android's back and Escape close it, as Android's dialogs do and an iOS alert does not
testIDstring—Test id

OverlayRestore

An overlay mounted already open comes in as one opened later does. In an OverlayRestore it stands in its place at once instead, with no entrance: a Dialog, a Bottom Sheet, an Action Sheet or a Menu. This is how Android restores a DialogFragment when its Activity is made again (a change of language, a turn of the screen) and iOS a presented view controller it restores. Wrap the screens an app draws again and turn it on for that change; an overlay mounted closed and opened later comes in as usual, and so does a restored one once it closes and opens again.

import { useState } from "react"
import { Dialog, OverlayRestore } from "@plexui/react-native"

// The screen is made again when the language changes (a key by language)
const [redrawn, setRedrawn] = useState(false)

<OverlayRestore active={redrawn}>
  <Screen key={language}>
    <Dialog
      open={open}
      onOpenChange={setOpen}
      title="Language"
      description="The screen is drawn again in another language."
      actions={[
        { label: "Close", variant: "cancel" },
        { label: "Español", preferred: true, keepOpen: true, onPress: () => {
          setRedrawn(true)
          setLanguage("es")
        } },
      ]}
    />
  </Screen>
</OverlayRestore>
PropTypeDefaultDescription
activebooleantrueOverlays mounted open inside it stand in place at once, with no entrance; off, they come in as usual
childrenReactNode—The screens drawn again

DialogAction

PropTypeDefaultDescription
labelstring—The action's label (required)
onPress() => void—Called when the action is pressed, before the dialog closes
variant"default" | "cancel" | "destructive""default"A cancel stands first of two side by side on iOS, and just before the preferred action on Android; a destructive action is red
preferredbooleanfalseThe preferred action: semibold white on the accent on iOS, the last button at the end on Android
disabledbooleanfalseDims the action and takes no presses
keepOpenbooleanfalseKeeps the dialog open after the action
testIDstring—Test id