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 26 | Android | |
|---|---|---|
| Native component | Alert | Dialog |
| Look | Glass panel with capsule actions | A 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
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | — | Shows the dialog (required) |
onOpenChange | (open: boolean) => void | — | Called with false when an action, a tap outside or Back closes it (required) |
title | ReactNode | — | The title. Without one the dialog is its message alone: an iOS alert with only a message, Material 3's supporting text alone |
description | ReactNode | — | The message under the title, or the whole text of a dialog without one |
image | ReactNode | — | 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 |
actions | DialogAction[] | [] | The actions; two stand side by side on iOS, three or more stack |
children | ReactNode | — | 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) |
dismissible | boolean | true on Android, false on iOS | A tap outside, Android's back and Escape close it, as Android's dialogs do and an iOS alert does not |
testID | string | — | 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>| Prop | Type | Default | Description |
|---|---|---|---|
active | boolean | true | Overlays mounted open inside it stand in place at once, with no entrance; off, they come in as usual |
children | ReactNode | — | The screens drawn again |
DialogAction
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | 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 |
preferred | boolean | false | The preferred action: semibold white on the accent on iOS, the last button at the end on Android |
disabled | boolean | false | Dims the action and takes no presses |
keepOpen | boolean | false | Keeps the dialog open after the action |
testID | string | — | Test id |