Skip to Content
ARCUI

Dialog

Provider-owned imperative ARCUI dialog API with explicit actions, async loading, controlled dismissal, replacement lifecycle, and tokenized enter/exit motion.

Dialog is an imperative ARCUI API, not a public <Dialog /> component import. ARCUI owns one global Dialog host and coordinates presentation, actions, replacement, accessibility isolation, and exit completion through the root provider.

Imperative presentation with explicit actions, async loading, icons, passive dismissal, replacement lifecycle, and ARCUI motion.

Usage

import { showDialog } from "react-native-arc-ui";

showDialog({
  title: "Continue?",
  message: "Your current changes will be preserved.",
  actions: [{ label: "Continue" }],
});

The root <ARCUI> provider must already be mounted. Calling showDialog() or hideDialog() without an active ARCUI provider fails clearly because the global Dialog host is an architectural requirement.

Content

title and message are independently optional.

showDialog({
  title: "Unsaved changes",
  message: "You can keep editing or leave this screen.",
  actions: [
    { label: "Keep editing" },
    { label: "Leave", type: "border" },
  ],
});

ARCUI renders Dialog-owned text with tokenized typography, central font scaling, animated theme colors, and safe-area-aware positioning.

Actions

Dialog does not generate an implicit confirmation action. actions is explicit application intent.

showDialog({
  title: "Delete account?",
  message: "This cannot be undone.",
  actions: [
    {
      label: "Delete",
      type: "solid",
      tone: "danger",
      onPress: deleteAccount,
    },
    {
      label: "Cancel",
      type: "border",
    },
  ],
});

When type is omitted, ARCUI resolves action presentation by order:

first     -> solid
second    -> border
remaining -> transparent
Example
ARCUI Dialog action configurations

Action configuration

Each action accepts:

PropTypeDefaultPurpose
labelstringrequiredVisible Button label
type"solid" | "border" | "transparent"order-basedButton presentation
tone"primary" | "secondary" | "neutral" | "danger""primary"Semantic Button palette
colorsIButtonColors—Per-action Button color slots
onPress() => void | Promise<void>—Action work
autoDismissbooleantrueClose after a successful action
disabledboolean—Disable this action
testIDstringgeneratedStable action test identity

Dialog actions are rendered with ARCUI Button, so Button semantics, loading feedback, theming, and Reduced Motion behavior carry through consistently.

Dialog's own colors object separately controls backdrop, background, title, message, and icon. Each accepts a fixed color or complete light/dark pair. The action colors slots use the Button color contract rather than a parallel Dialog action palette.

Async actions

Return a Promise from onPress when the action has asynchronous work.

showDialog({
  title: "Save changes?",
  actions: [
    {
      label: "Save",
      onPress: async () => {
        await saveChanges();
      },
    },
  ],
});

ARCUI automatically puts that action into Button loading state until the Promise settles.

While one action is awaiting an async result:

  • that action shows loading feedback;
  • other actions are disabled;
  • rapid additional action presses are ignored synchronously, even before React has committed the loading state.
Motion

A rejected/throwing action is not treated as successful dismissal. ARCUI keeps the Dialog open, clears loading state, and surfaces the error through the runtime console.

Automatic dismissal

autoDismiss defaults to true per action.

showDialog({
  title: "Connection failed",
  actions: [
    {
      label: "Retry",
      autoDismiss: false,
      onPress: retryConnection,
    },
  ],
});

When autoDismiss is true, ARCUI requests close only after the action completes successfully.

Manual dismissal

Use hideDialog() when application logic owns the close boundary.

import { hideDialog, showDialog } from "react-native-arc-ui";

showDialog({
  title: "Uploading",
  actions: [
    {
      label: "Start",
      autoDismiss: false,
      onPress: async () => {
        await upload();
        hideDialog();
      },
    },
  ],
});

hideDialog() closes the current Dialog through the same lifecycle as other close paths and also clears any replacement that has been requested but not yet presented.

Passive dismissal

Dialogs are not passively dismissible by default.

showDialog({
  title: "Preview",
  dismissible: true,
});

When dismissible is enabled, supported passive close interactions include:

  • backdrop press;
  • Android hardware back;
  • accessibility escape.

Android Back is always consumed while Dialog owns the screen. For a non-dismissible Dialog, Back therefore does not navigate the application underneath it.

Dismiss callback

onDismiss runs after the Dialog completes its exit animation and no longer owns the host.

showDialog({
  title: "Complete",
  actions: [{ label: "Done" }],
  onDismiss: () => {
    cleanupAfterDialog();
  },
});

ARCUI clears the old Dialog's lifecycle ownership before invoking onDismiss. If onDismiss itself shows a new Dialog, that newer request wins over any older pending replacement.

Icons

Use either a built-in ARCUI icon name or custom React element content.

showDialog({
  icon: "info",
  title: "Information",
  actions: [{ label: "OK" }],
});
showDialog({
  customIcon: <BrandGlyph />,
  title: "Premium",
  actions: [{ label: "Continue" }],
});

icon and customIcon are mutually exclusive in the public type.

Replacement lifecycle

ARCUI intentionally supports one active Dialog, not a Dialog stack.

If showDialog() is called while another Dialog is active:

  1. the new request becomes the pending replacement;
  2. the current Dialog begins its normal exit lifecycle;
  3. only the latest pending replacement is retained;
  4. after the current Dialog fully exits, the pending replacement is promoted if the host is still free.

This design protects newer Dialogs from stale async actions and stale animation completions.

showDialog({ title: "First", actions: [{ label: "OK" }] });
showDialog({ title: "Second", actions: [{ label: "OK" }] });
showDialog({ title: "Latest", actions: [{ label: "OK" }] });

Only the latest pending replacement survives while the current Dialog exits.

Enter and exit motion

Dialog enter/exit movement is configured through tokens.dialogAnimations, not instance props.

Supported directions are:

center
top
bottom
left
right

exiting defaults to the resolved entering direction when omitted.

Reduced Motion removes directional travel distance while preserving the opacity transition and lifecycle semantics.

Testing

testID becomes the Dialog test prefix.

showDialog({
  testID: "delete-account",
  title: "Delete account?",
  actions: [
    { label: "Delete", testID: "delete-confirm" },
    { label: "Cancel" },
  ],
});

Stable Dialog descendants include:

delete-account-dialog
delete-account-dialog-backdrop
delete-account-dialog-icon
delete-account-dialog-title-text
delete-account-dialog-content-text
delete-account-dialog-action-0
delete-account-dialog-action-1

An action's explicit testID replaces its generated action ID.

When testID is omitted entirely, ARCUI uses Dialog as the internal prefix.

For provider setup and the dedicated react-native-arc-ui/testing entrypoint, see Testing.

API Reference

showDialog

showDialog(dialog: TDialog): void

Presents a Dialog through the active ARCUI provider. If another Dialog owns the host, the latest request becomes the pending replacement.

hideDialog

hideDialog(): void

Requests the current Dialog to close and clears an unpresented pending replacement.

Dialog configuration

Dialog Built In Icon

PropTypeDefaultDescription
title?string——
message?string——
colors?Readonly<IDialogColors>—Per-instance ARCUI-owned Dialog color overrides.
actions?readonly TDialogAction[]—Explicit Dialog actions. ARCUI does not generate an implicit confirmation action.
dismissible?booleanfalseAllows passive dismissal through supported platform interactions such as backdrop press, Android back, and accessibility escape.
onDismiss?() => void—Called after the Dialog has completed its exit animation and is no longer visible.
testID?string——
icon?IIcon["type"]——

Dialog Custom Icon

PropTypeDefaultDescription
title?string——
message?string——
colors?Readonly<IDialogColors>—Per-instance ARCUI-owned Dialog color overrides.
actions?readonly TDialogAction[]—Explicit Dialog actions. ARCUI does not generate an implicit confirmation action.
dismissible?booleanfalseAllows passive dismissal through supported platform interactions such as backdrop press, Android back, and accessibility escape.
onDismiss?() => void—Called after the Dialog has completed its exit animation and is no longer visible.
testID?string——
customIcon?ReactElement | null——

Per-instance color slots: IDialogColors

PropTypeDefaultDescription
backdrop?TThemeColor——
background?TThemeColor——
title?TThemeColor——
message?TThemeColor——
icon?TThemeColor——

Generated from the ARCUI 2.0.0 TypeScript source snapshot. Native inherited props remain available through the referenced React Native surface.

Generated from the ARCUI 2.0.0 TypeScript source snapshot. Native inherited props remain available through the referenced React Native surface.

The generated table models the mutually exclusive built-in/custom icon variants. Action configuration is documented above because TDialogAction is nested within the actions array rather than a standalone page contract.

Motion

Dialog semantics stay in React/provider state while visual transitions use Reanimated SharedValues.

ARCUI owns:

  • backdrop opacity;
  • surface opacity;
  • directional translate offsets;
  • theme color interpolation;
  • cancellation/replacement of active transitions;
  • stale lifecycle guards.

The motion lifecycle is coordinated with semantic host ownership so an old animation completion cannot remove a newer Dialog.

See Motion.

Performance

Open/close visuals are not driven by React state per frame. Async action loading uses React semantic state because it changes actual action behavior, while Button handles its own frame-level visual transition.

The single-host replacement model also avoids maintaining an unnecessary visual Dialog stack when the product semantics support one active decision surface at a time.

See Performance.

Accessibility

When a Dialog is active, ARCUI hides the underlying application layer from accessibility traversal.

Dialog also provides:

  • modal accessibility semantics on the Dialog positioner;
  • header semantics for the title;
  • Button semantics for actions;
  • disabled/loading action state through Button;
  • accessibility escape only when dismissible permits passive dismissal;
  • safe-area-aware placement;
  • central ARCUI font scaling for owned title/message text.

The backdrop itself is intentionally not a duplicate accessible control; passive screen-reader dismissal is handled through accessibility escape.

See Accessibility.

Theming

Relevant token areas include:

colors.light.dialog
colors.dark.dialog
radius.dialog
sizings.dialog
typography.dialog
safeArea.dialog
dialogAnimations
animations
zIndex.dialog
zIndex.dialogBackdrop

Dialog actions additionally consume Button tokens.

dialogAnimations provides:

duration / easing      -> component override with global animation fallback
entering               -> enter direction
exiting                -> optional exit direction
distance                -> directional travel amount

Top-level token overrides are shallow. Compose changed namespaces from defaultTokens.

import { ARCUI, defaultTokens, type TTokensOverride } from "react-native-arc-ui";

const tokens = {
  dialogAnimations: {
    ...defaultTokens.dialogAnimations,
    entering: "bottom",
    exiting: "bottom",
    distance: 60,
  },
} satisfies TTokensOverride;

export function App() {
  return <ARCUI tokens={tokens}>{/* application */}</ARCUI>;
}

See Tokens and Theming.

Try it live

Use the existing Snack to explore actions, async loading, icons, passive dismissal, and Dialog motion.

Open Dialog in Expo Snack ↗

On this page