Prodular UI

Dialog

A modal window for a focused task, such as a short form or a review step, that blocks the page until it is done or dismissed.

npx prodular-ui add dialog

Form

Header, fields and a footer with the primary action on the right.

Sizes

sm for one input or a rename, default for most forms, lg for content that needs width.

Long content

Wrap the middle in DialogBody so it scrolls while the header and footer stay in place.

Anatomy

<Dialog>  <DialogTrigger render={<Button variant="outline" />}>Invite teammates</DialogTrigger>  <DialogContent size="default">    <DialogHeader>      <DialogTitle>Invite teammates</DialogTitle>      <DialogDescription>They get access to every shared project.</DialogDescription>    </DialogHeader>    <DialogBody>{/* fields */}</DialogBody>    <DialogFooter>      <DialogClose render={<Button variant="outline" />}>Cancel</DialogClose>      <Button>Send invites</Button>    </DialogFooter>  </DialogContent></Dialog>

Guidance

Use it when

  • Use for a short task that must be finished or cancelled before the user goes back to the page: invite people, rename, connect an integration.
  • Use size sm for a single field, default for forms up to about six fields, lg for previews, tables or two column layouts.
  • Put the primary action last in DialogFooter so it sits on the right, with Cancel to its left.

Avoid

  • Confirming a destructive action. Use Alert dialog, which cannot be dismissed by clicking outside.
  • Long multi step flows or anything the user wants to compare with the page behind. Use a Sheet or a full page.
  • Nesting cards or tinted panels inside the dialog. Separate sections with border-t or divide-y.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Always render DialogTitle. If the design has no visible title, keep it and add className="sr-only".
  • Add DialogDescription when the title alone does not explain what happens.
  • Open from a DialogTrigger with render={<Button />}, or control it with open and onOpenChange. Do not toggle it with conditional rendering.
  • Use DialogClose render={<Button variant="outline" />} for Cancel. Do not write your own close handler for it.
  • Wrap long content in DialogBody. Never make the whole DialogContent scroll.
  • Pick size from the content: sm, default or lg. Do not set a max-w class yourself unless a size does not fit.

API

Dialog

PropTypeDefaultDescription
open / onOpenChangeboolean / (open: boolean) => voidControlled state. Omit both for uncontrolled with defaultOpen.

DialogContent

PropTypeDefaultDescription
size"sm" | "default" | "lg""default"Max width: 24rem, 32rem or 42rem.
showCloseButtonbooleantrueRenders the icon button in the top right corner.

DialogFooter

PropTypeDefaultDescription
showCloseButtonbooleanfalseAdds an outline Close button before the other actions.

DialogTrigger

PropTypeDefaultDescription
renderReactElementRenders the trigger as another element, usually a Button.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add dialog# or, with the registry in components.jsonnpx shadcn@latest add @prodular/dialog

Used in these screens