Dialog

A React component in Beamline's Overlays category, in the free sample.

A focused task over the page (create, invite, rename) with a title, body and footer; focus moves in, is trapped and returns on close.

Use it for

  • Short focused tasks that need attention without leaving the page: create, invite, rename, import.

Not for

  • Long editing beside a list (sheet).
  • Blocking destructive confirmations (alert-dialog).
  • Information that needs no answer (toast).

Anatomy

  • Dialog
  • DialogTrigger
  • DialogContent (scrim, title, description, body, ×)
  • DialogFooter
  • DialogClose

Variants

  • size: sm 380, md 440, lg 560, xl 720

States

  • closed
  • open (focus to the first field or autoFocus; Tab trapped)
  • working (dismissible={false}: Escape, scrim and × off; primary Button loading keeps its size)
  • error (Alert at the top of the body, the field marked invalid with its words, drafts kept, focus moved to the field)
  • resolved (the caller closes on success; focus returns to the opener)
  • long content (header and footer stay; only the body scrolls)
  • narrow (a phone: the content answers to the dialog's own width; the footer's buttons share the row in equal parts)
  • next step (content of another height: the dialog eases to it in place)
  • closing

Keyboard

  • Escape closes (unless dismissible is false)
  • Tab is trapped inside
  • focus returns to the trigger

Motion

The scrim fades in; the dialog scales 0.96 → 1 over --pui-duration-standard on --pui-ease-enter and leaves over --pui-motion-out. Opens out of whatever opened it (_shared/use-open-from.ts): it starts as the opener's box, offset onto it, grows to its place over the considered duration while its content fades in, and closes back into the opener in 180 ms. Without an opener (a shortcut) the ordinary entrance runs. A size chosen while open eases the width in place, centred (--pui-duration-standard); when `step` changes (the next step of a flow) it eases to the new step's height, centred (a stepped tray, the shared useHeightMorph); a message added to the body (an error, a progress bar) grows in with .enter-grow so the dialog grows with it instead of jumping. Reduced motion: it fades.

Props

PropTypeDefaultDescription
titleReactNode—On DialogContent: The task, as a heading; also the dialog's accessible name.
descriptionReactNode—On DialogContent: One or two lines under the title.
size"sm" | "md" | "lg" | "xl""md"On DialogContent: Legacy width preset; omitted by default. Deprecated: Use width instead.
dismissiblebooleantrueOn DialogContent: Close on Escape and on a click outside. Set false while work is running that must not be abandoned (and hide the × with showClose={false}); Cancel and Done stay yours to offer. Default true.
stepstring | number—On DialogContent: The step of a flow the dialog shows (a string or a number). When it changes, the dialog eases to the new step's height in place instead of jumping (a stepped tray).
showClosebooleantrueOn DialogContent: The × in the corner. Default true.
footerReactNode—On DialogContent: Buttons at the bottom; DialogFooter lays them out the same everywhere.
open / defaultOpen / onOpenChangeboolean—open: Controlled open state; omit to use defaultOpen. defaultOpen: Initial open state when uncontrolled; defaults to false. onOpenChange: Reports an open-state change; no callback by default.
width"sm" | "md" | "lg" | "xl"—On DialogContent: Width preset: sm 380px, md 440px, lg 560px or xl 720px; defaults to md.
DialogContent.classNamesPartial<Record<"root" | "header" | "title" | "description" | "body" | "footer" | "scrim" | "close" | "tray", string>>—On DialogContent: Classes for the named visual parts; no part overrides by default.

Built from

Used in

Dependencies

@radix-ui/react-dialog, lucide-react

Import

import { DialogContent, DialogFooter, Dialog, DialogTrigger, DialogClose } from "@beamline/dialog";

Get it

Dialog is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Dialog is included in the free MIT sample. Get Beamline · Connect your agent

More in Overlays

  • Command menu: Search-first list of every action: ranked matching, groups, keycap shortcuts and nested pages; inline as CommandPalette or in a ⌘K dialog as CommandMenu.
  • Toast: Short results of an action stacked at an edge: point at the stack to fan it out and pause the timers; undo or retry in place; Alt+T, Escape and a swipe…
  • Share dialog: Share a document, board or project: invite people by name or email with the access they get, change or remove anyone's access in place, and set who the…
  • Context menu: Actions for an object on right-click, long-press, Shift+F10 or the menu key, opened at the pointer, with the same rows as the dropdown menu.
  • Hover card: A preview of a person, link or record on hover or keyboard focus, without leaving the page; HoverCardProfile is the standard person preview.
  • Product tour: A short guided tour over the real interface: a spotlight that glides from one element to the next while the rest of the screen dims, and a card beside…
  • Bottom sheet: A phone panel that rests at a peek and follows the finger to full height; a flick down closes it, and the handle works from the keyboard.
  • Sheet: A panel that slides in from an edge with the page still visible behind it: header and footer stay put while the body scrolls.
  • Dropdown menu: A list of actions behind a trigger, with shortcuts, check items, headings and submenus; one highlight glides under the pointer and jumps with the keyboard.
  • Alert Dialog: A blocking confirmation that must be answered: the scrim does not dismiss it, focus starts on the safe choice, and an async action keeps it open until…
  • Popover: A small surface anchored to a trigger for a short form, a filter or an explanation; focus moves in and returns on close.
  • Tooltip: Short supporting text for a control: opens after a moment on hover and at once on keyboard focus; inside a toolbar group the next one opens instantly.

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.