Skip to content

Dialog / modal

In review
Live · web

Variant: pick one, then open the dialog

Last outcome: none yet. Esc, Cancel, the scrim, or the close button dismisses; Enter / the default action resolves. The island is live.

// Web: React, consuming @dizyx/nockerl-tokens. (Web is the laggard platform;
// this is the canonical API the published @dizyx/nockerl-react package exposes.)
// NockerlDialog composes the shipped NockerlOverlay primitive (scrim + focus-trap + Esc);
// it supplies the centered card, the scale-in motion, and the Enter=confirm shortcut.
import { NockerlDialog } from '@dizyx/nockerl-react';
export function DeleteSessionDialog({ open, name, stage, onCancel, onDelete }: Props) {
return (
<NockerlDialog
open={open}
stage={stage}
title="Delete session?"
tone="destructive"
icon="warning"
confirmLabel="Delete"
onConfirm={onDelete}
onDismiss={onCancel}
>
<p>“{name}” will be permanently removed.</p>
<p className="muted">Chat history is preserved on the server.</p>
</NockerlDialog>
);
}
PropTypeDefaultDescription
open *booleanWhether the dialog is presented.
onDismiss *() => voidDismiss handler: scrim tap, Esc, Cancel, or the close (X) button.
onConfirm *() => voidDefault-action handler: the confirm button + Enter.
title *stringAccessible title; carries the dialog name (aria-labelledby).
confirmLabelstring'Confirm'Confirm-button label.
cancelLabelstring | null'Cancel'Cancel-button label. null hides Cancel (a single-action alert).
tone'primary' | 'destructive''primary'Emphasis of the default action: primary cyan or destructive red.
icon'warning' | 'fork'Optional leading header glyph key (warning for destructive, fork for branch).
confirmDisabledbooleanfalseDisable the confirm action (e.g. an unsatisfied form).
stage *HTMLElement | nullThe contained stage element, which gates rendering so the dialog never escapes it.
children *React.ReactNodeBody: supporting text and/or a form field.
Dialog vs. bottom sheet

Reach for a dialog when the choice is short, blocking, and platform-neutral: a confirm, an alert, or a one-field prompt that wants the user’s full attention, centered over a scrim. Reach for the bottom sheet when the surface is a longer, scrollable, thumb-reachable list of actions or settings on mobile. Same scrim + focus-trap + Esc/scrim-dismiss vocabulary; different anchor (centered card vs. bottom edge) and posture (decision vs. browse).

Cross-platform drift (tracked for reconciliation)
  • Custom vs. stock: Android centers a custom-styled Material AlertDialog filled with NockerlButtons; Voice uses the stock SwiftUI .alert / .confirmationDialog (no bespoke card), so the macOS scrim, radius, and button order are system-supplied, not token-driven. Web is the intended original.
  • Icon header: web + Compose support a leading glyph in the title; SwiftUI alerts have no icon slot.
  • Button order: web + Compose place Cancel ← Confirm (confirm trailing); SwiftUI orders role-tagged buttons itself.