Theme
Install with your agentnpx shadcn@4.23.1 add @goop/trail-dialog

Dialog

Free

A window over the page for one focused task, such as a short form, for React and Tailwind CSS. Free, MIT.

Press "Archive list": the dialog asks first. Archive list is busy for a moment and the list shows archived, with Bring back beside it. Cancel, Escape, the cross or a click outside leave it as it was; the focus comes back to the button (after an archive, to Bring back). The archive is a timer; the list lives in the page only.

When to use

  • A window over the page for one focused task, such as a short form.
  • Also called: modal or popup.

When not to use

Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Dialog on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

Terminal
npx shadcn@4.23.1 add @goop/trail-dialog
PROMPT
Add the Goop Dialog to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import {
  Dialog, DialogTrigger, DialogPortal, DialogClose, DialogOverlay, DialogContent, DialogHeader, DialogHeaderActions, DialogTitle, DialogDescription, DialogBody, DialogTitleBox, DialogDescriptionBox,
  DialogToolbar, DialogFooter, DialogFooterGroup, DialogFooterEnd,
} from '@/components/ui/goop/dialog';
import { Button } from '@/components/ui/goop/button';

<Dialog>
  <DialogTrigger asChild>
    <Button variant="outline">Archive list</Button>
  </DialogTrigger>
  <DialogContent size="xs">
    <DialogHeader closeLabel="Close">
      <DialogTitle>Archive this list?</DialogTitle>
    </DialogHeader>
    <DialogBody>
      <DialogDescription>Its 12 notes move to the archive, and you can bring the list back from there.</DialogDescription>
    </DialogBody>
    <DialogFooter>
      <DialogFooterEnd>
        <DialogClose asChild>
          <Button variant="outline">Cancel</Button>
        </DialogClose>
        <Button>Archive list</Button>
      </DialogFooterEnd>
    </DialogFooter>
  </DialogContent>
</Dialog>
  • Fits: list, settings: overlay.
  • height, width, padding, gap, corner, border, background, shadow, text, motion: add no class for these.

API reference

Options
OptionTypeWhat it does
open?boolean
defaultOpen?boolean = false
onOpenChange?(open: boolean) => void
modal?boolean = true
  • State: open (open / defaultOpen / onOpenChange); drawn by data-focus-visible, data-state=closed
Parts
PartWhat it is
DialogTriggerWraps the control that opens the dialog; put the theme's Button inside with asChild; also takes asChild?: boolean
DialogPortalWhere the layer is drawn
DialogCloseWraps a control that closes the dialog, such as a Cancel button in the footer; also takes asChild?: boolean
DialogOverlayThe dimmed backdrop behind a modal dialog; DialogContent draws it, so add none yourself
DialogContentThe scrim, the positioner and the panel, in a portal — the end of <body>, or container; its props: dialog--content.md
DialogHeaderThe dialog's top row; put the DialogTitle in it, with any chips or actions before the close; its props: dialog--header.md
DialogHeaderActionsThe header's actions, 12 px after its content and 6 px apart (in the window 2 px apart); its props: dialog--header-actions.md
DialogTitleThe dialog's name, which every dialog needs; put it in the DialogHeader
DialogDescriptionA line that says what the dialog is for, read out with its title; put it in DialogBody
DialogBodyThe dialog's main content (description, fields, text), between its header and footer
DialogTitleBoxThe boxes a one-line field sits in at the body's top (the caller's field, the theme's TextInput)
DialogDescriptionBoxThe boxes a many-line field sits in under it (the caller's field, the theme's Textarea)
DialogToolbarA row of controls under the body (property chips, a round button)
DialogFooterThe dialog's bottom row for its buttons; put them in DialogFooterEnd, the main action last
DialogFooterGroupThe footer's group at its start (an attach button)
DialogFooterEndThe footer's end, growing, its controls at the end 12 px apart (the main action the last)
  • Required: DialogTitle, inside DialogContent

DialogContent

The scrim, the positioner and the panel, in a portal — the end of <body>, or container.

TSX
import { DialogContent } from '@/components/ui/goop/dialog';

Options

  • variant: default (default), window
  • size: xs, sm, md (default), lg, full
  • container?: HTMLElement | null — Where the layer is portalled; the end of <body> when left out.

DialogHeaderActions

The header's actions, 12 px after its content and 6 px apart (in the window 2 px apart).

TSX
import { DialogHeaderActions } from '@/components/ui/goop/dialog';

Options

  • closable?: boolean = true — Draw the default close button last (true); false when the caller's children hold their own, or none is wanted.
  • closeLabel?: string = 'Close' — The default close button's accessible name.

Accessibility

  • The behaviour layer under the part answers keys, focus and dismissal: never write your own.

Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:

StateDrawn by
focus-visiblethe attribute data-focus-visible
expandedthe attribute data-state=closed
openthe attribute data-state=closed

Motion

  • The part sets its own motion: add no transition or animation of your own.
  • How the theme moves, and how to move your own parts the same way: Motion.

Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

goop.so/themes/trail/components/dialog.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add @goop/trail-dialog

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.