Dialog

System alerts and custom modal dialogs.

  • Native host
  • Liquid Glass on iOS 26
  • In the first release
import { Dialog, dialogPrimitive } from "nitro-ui-sdk/dialog";
HeroUI Native
Dialog
Expo UI
AlertAlertDialog
  • Dialog example screen, light appearance
    Light
  • Dialog example screen, dark appearance
    Dark
  • Dialog example screen, liquid glass appearance
    Liquid Glass
On this page

Dialog presents a system alert or a focused panel over the current screen. Use ActionSheet for related commands or Sheet for a task that needs more room.

Anatomy

import { Dialog } from "nitro-ui-sdk/dialog";

<Dialog.Root label="Review draft" title="Ready to save?" cancelLabel="Close" variant="custom">
  <Dialog.Trigger />
  <Dialog.Content>
    <Dialog.Title />
    <Dialog.Description>Your draft will stay private.</Dialog.Description>
    <Dialog.Cancel />
  </Dialog.Content>
</Dialog.Root>;
Part Description
Root Owns open state and actions.
Trigger Named button opening the dialog.
Content Mounts the native alert or a scrollable custom panel.
Title Accessible custom panel heading.
Description Supporting text.
Action A button linked to a Root action by ID.
Cancel A dismiss button for the custom panel.

Usage

import { Dialog } from "nitro-ui-sdk/dialog";

<Dialog.Root label="Show alert" title="Draft saved" cancelLabel="Close" />;

Variants and sizes

alert and confirm use the system presentation. custom hosts React content in a bounded panel. The style resolver defaults to system size for alerts and bounded for custom content.

States

Set disabled to prevent opening and dispatch. Individual actions can be disabled or destructive. An action can decline using details.preventDefault().

Controlled

import { useState } from "react";
import { Dialog } from "nitro-ui-sdk/dialog";

export function DraftDialog() {
  const [open, setOpen] = useState(false);
  return <Dialog.Root label="Show alert" title="Draft saved" cancelLabel="Close" value={open} onValueChange={setOpen} />;
}

Use defaultValue for initial uncontrolled visibility. Call details.preventDefault() to decline an open or cancel request.

Liquid Glass

System alerts use the appearance provided by UIKit. The custom dialog uses the opaque overlay palette for body content, with a Liquid Glass trigger and dismiss control. Both use an opaque fallback.

Props

Root

Prop Type Default Description
label string required Trigger name.
title string required Dialog heading.
description string — Body text.
cancelLabel string required Localized dismiss label.
actions readonly DialogAction[] [] Action IDs, labels, callbacks and optional disabled, destructive and confirm settings.
variant DialogVariant alert Presentation style.
size DialogSize resolved by variant Size passed to style resolvers.
value / defaultValue boolean false Controlled or initial visibility.
onValueChange (open, details) => void — Visibility request with source.
disabled boolean false Gates opening and choice activation.
styles PartStyles — Part style resolvers.
api Controller — Controller binding.
agentId string — Stable agent identity.
children ReactNode Trigger and Content Custom anatomy.

Trigger, Title, Description, Cancel

Prop Type Default Description
part DialogPart component part Style part to resolve.
children string matching Root text Override visible title, label or description.

Content

Prop Type Default Description
part DialogPart content Style part to resolve.
children ReactNode default content Hosted body for the custom variant.

Action

Prop Type Default Description
id string required Selects a Root action.
part DialogPart action Style part to resolve.
children string action label Override button label.

Controller API

import { useState } from "react";
import { Dialog, dialogPrimitive } from "nitro-ui-sdk/dialog";

export function DraftDialog() {
  const [api] = useState(dialogPrimitive.createApi);
  return <Dialog.Root label="Show alert" title="Draft saved" cancelLabel="Close" api={api} />;
}
Action Signature Result
open (source?) => ChangeStatus Requests presentation.
cancel (source?) => ChangeStatus Requests dismissal.
press (id, source?) => ActionStatus Runs a configured choice and requests dismissal after acceptance.

Styles

import { Dialog } from "nitro-ui-sdk/dialog";

<Dialog.Root label="Review draft" title="Ready to save?" cancelLabel="Close" variant="custom"
  styles={{ content: ({ tokens }) => ({ style: { cornerRadius: tokens.radius.sheet } }) }} />;

Resolvers receive the tokens, variant, size, and open and disabled fields. UIKit controls internal alert layout.

Accessibility

The trigger and custom choices are named buttons, and the custom title is a heading. Focus moves into the presentation and returns on close. Platform dismissal supports the accessibility escape action.

Agent API

Action Arguments Notes
open None Opens from the trigger.
press Action ID string Dispatches from the foreground dialog. confirm gates protected choices.
cancel None Dismisses the foreground dialog.

Platform notes

iOS Android
Implementation UIAlertController or custom UIViewController hosting a React panel. AlertDialog or a custom React panel hosted in a DialogFragment.
Verification iOS harness. Implementation written. Build and runtime verification require an Android NDK.