InkUI
Components

Dialog

Modal dialog with title, message body, action buttons, and Escape-to-dismiss.

A modal dialog for confirmations, warnings, and prompts. Supports left/right action navigation and Escape-to-dismiss.

Live Preview
Dialog · confirmation
Press d to open dialog
Confirm delete
This action cannot be undone.
[Delete][Cancel]
~/my-cli — node v22● running

Installation

npx inkui add dialog

Usage

import { useState } from 'react';
import { Dialog } from './components/ui/dialog';
 
export default function App() {
  const [open, setOpen] = useState(true);
 
  return (
    <Dialog
      isOpen={open}
      title="Deploy to production?"
      message="This will push changes to all users."
      actions={[
        { label: 'Cancel',  value: 'cancel'  },
        { label: 'Confirm', value: 'confirm' },
      ]}
      onAction={(action) => {
        if (action.value === 'confirm') deploy();
        setOpen(false);
      }}
      onDismiss={() => setOpen(false)}
    />
  );
}

Examples

Destructive confirmation

<Dialog
  isOpen={open}
  title="Delete project?"
  message={"This action cannot be undone.\nAll data will be permanently deleted."}
  actions={[
    { label: 'Keep',   value: 'keep'   },
    { label: 'Delete', value: 'delete' },
  ]}
  onAction={handleAction}
  onDismiss={() => setOpen(false)}
/>

Info dialog (no dismiss)

<Dialog
  isOpen={showInfo}
  title="Update available"
  message="InkUI v0.4.0 is available. Run npx inkui update."
  actions={[{ label: 'OK', value: 'ok' }]}
  onAction={() => setShowInfo(false)}
/>

Custom border

<Dialog
  isOpen={open}
  title="Confirm"
  message="Are you sure?"
  actions={actions}
  onAction={handleAction}
  borderStyle="double"
/>

Props

PropTypeDefaultDescription
isOpenbooleanControls whether the dialog renders (required)
messagestringBody message — supports \n for multi-line (required)
actionsDialogAction[]Array of { label, value } buttons (required)
onAction(action: DialogAction) => voidCalled when user confirms an action (required)
onDismiss() => voidundefinedCalled when user presses Escape
titlestringundefinedBold title at the top of the dialog
focusbooleantrueWhether this dialog captures keyboard input
borderStyleBorderStyle'rounded'Border style key from @inkui-cli/core
themeInkUIThemedarkThemeColor theme

On this page