agentic-ui logoagentic-ui

Dialog

Modal overlay dialog. Use the high-level wrapper for quick usage, or compose individual styled parts with a raw base-ui Root for full control.

High-level wrapper

import { Button } from "@brijbyte/agentic-ui/button";
import { Dialog } from "@brijbyte/agentic-ui/dialog";
import { Input } from "@brijbyte/agentic-ui/input";

import "@brijbyte/agentic-ui/button.css";
import "@brijbyte/agentic-ui/dialog.css";
import "@brijbyte/agentic-ui/input.css";

export default function HighLevelDemo() {
  return (
    <>
      <Dialog
        trigger={<Button>Confirm dialog</Button>}
        title="Confirm action"
        description="Are you sure you want to delete this resource? This action cannot be undone."
        footerStart={
          <Button variant="soft" tone="destructive" size="sm">
            Delete
          </Button>
        }
        footer={
          <Button variant="ghost" size="sm">
            Cancel
          </Button>
        }
      />

      <Dialog
        trigger={<Button variant="outline">API Settings</Button>}
        title="API Settings"
        description="Configure your API endpoint and credentials."
        footer={
          <>
            <Button variant="ghost" size="sm">
              Cancel
            </Button>
            <Button size="sm">Save changes</Button>
          </>
        }
      >
        <div style={{ display: "flex", flexDirection: "column", gap: "var(--space-3)" }}>
          <Input defaultValue="https://api.example.com/v1" />
          <Input type="password" placeholder="sk-…" />
        </div>
      </Dialog>
    </>
  );
}

Composed: base-ui Root + styled parts

import { Dialog as BaseDialog } from "@base-ui/react/dialog";
import { Button } from "@brijbyte/agentic-ui/button";
import { DialogBackdrop, DialogViewport, DialogPopup, DialogTitle, DialogDescription, DialogClose } from "@brijbyte/agentic-ui/dialog";
import "@brijbyte/agentic-ui/button.css";
import "@brijbyte/agentic-ui/dialog.css";

export default function ComposedDemo() {
  return (
    <BaseDialog.Root>
      <BaseDialog.Trigger render={<Button variant="outline">Composed dialog</Button>} />
      <BaseDialog.Portal>
        <DialogBackdrop />
        <DialogViewport>
          <DialogPopup>
            <DialogTitle>Composed with base-ui Root</DialogTitle>
            <DialogDescription>Raw base-ui Root combined with styled parts from agentic-ui.</DialogDescription>
            <DialogClose aria-label="Close"></DialogClose>
          </DialogPopup>
        </DialogViewport>
      </BaseDialog.Portal>
    </BaseDialog.Root>
  );
}

API Reference

Modal overlay dialog with title, description, body, and footer slots.
Wraps @base-ui/react Dialog with a pre-styled backdrop, popup, and
close button. Use footerStart for a macOS-style left-aligned
destructive action.

PropTypeDefault
openboolean

Controlled open state.

defaultOpenboolean

Whether the dialog is initially open (uncontrolled).

onOpenChange((open: boolean, eventDetails: unknown) => void)

Called when the dialog opens or closes. eventDetails is the base-ui event details object.

triggerReactElement<unknown, string | JSXElementConstructor<any>>

Element that opens the dialog when clicked.

titleReactNode

Heading rendered at the top of the dialog.

descriptionReactNode

Supplementary text below the title.

footerReactNode

Buttons aligned to the right (cancel, confirm).

footerStartReactNode

Content anchored to the left of the footer — intended for a destructive
action (e.g. Delete). When present the footer switches to space-between
layout, matching the macOS dialog pattern.

classNamestring
dismissiblebooleantrue

Whether the dialog can be closed by clicking the backdrop or pressing Escape.

Styled Parts

base-ui docs ↗

Pre-styled wrappers around the corresponding base-ui parts. All base-ui props are forwarded.

CSS Class Names

Available as keys on the DialogStyles object. Each key maps to a hashed CSS module class name at runtime.

backdropbodyclosedescriptionfooterfooter-endfooter-splitheaderpopuptitle