---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Create dialog

A dialog to make a new record, title first, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `CreateDialog`.

## Try it

Open "New project": the title takes the focus. Type a name, pick a status, a priority, a lead, labels and a target date from their chips (Tab to a chip, Enter opens it, type to filter; "No priority" and "No lead" at the top of their lists set them back to none; type a label the list lacks and Enter on "Create “…”" makes it; on a narrow screen each chip is its icon alone, its name in a tooltip under the pointer or the keyboard’s focus), then ⌘ Enter or Create project: the button is busy for a moment and the project joins the list. A name already in the list is refused in place. Escape keeps what you typed as a draft for the next opening; "Create more" keeps the dialog open for the next one. The line under the list says when the dialog opens and closes.

The save is a timer; the projects live in the page only, the draft in this browser’s storage.

## When to use

- A dialog to make a new record, title first.
- Use it for every "New …" a person starts from a page's main button, a palette command or a key: the title is the one thing a person must type, so a create never asks for a form of stacked labelled fields. Give it the button that opens it as `trigger`, so the card opens beside it. Put each property the thing has in `properties` (status and priority as choices, the lead a `person`, `labels`, a target `date`, an amount typed as a `number` with its `currency`, never a choice over fixed amounts); a create row inside a list (`CreateRow`) is the lighter way to add one item where the list is. In `onCreate`, put the new item in its sorted place and focus it: as the dialog closes the focus stays where you put it.

## When not to use

- In a list use CreateRow.

## 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 Create dialog on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-create-dialog.json --yes
```

```text
Add the Goop Create dialog to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { CreateDialogSection } from '@/components/goop/patterns/create-dialog';

import { useState } from 'react';
import { Button } from '@/components/ui/goop/button';
import { CreateDialog } from '@/components/goop/patterns/create-dialog';

function NewProject() {
  const [projects, setProjects] = useState<string[]>([]);
  const [more, setMore] = useState(false);
  return (
    <CreateDialog
      trigger={<Button>New project</Button>}
      heading="New project"
      titleLabel="Project name"
      titlePlaceholder="Project name"
      submitLabel="Create project"
      properties={[
        {
          name: 'status',
          label: 'Status',
          icon: 'circle-dotted',
          options: [
            { value: 'planned', label: 'Planned', status: 'todo' },
            { value: 'started', label: 'In progress', status: 'in-progress' },
          ],
        },
        { kind: 'person', name: 'lead', label: 'Lead', options: [{ value: 'dagny', label: 'Dagny Holm' }] },
        { kind: 'date', name: 'due', label: 'Due date' },
        { kind: 'number', name: 'budget', label: 'Budget', icon: 'credit-card', currency: 'EUR' },
      ]}
      defaultValues={{ properties: { status: 'planned' } }}
      draftKey="new-project"
      createMore={more}
      onCreateMoreChange={setMore}
      onCreate={(values) => {
        if (projects.includes(values.title)) throw new Error(`There is a project called ${values.title} already.`);
        setProjects((now) => [values.title, ...now]);
      }}
    />
  );
}
```

- Fits: board, schedule (their recipes); frame: sidebar-head; frame: sidebar-search.
- More on where it goes: create-dialog--options.md
- height, width, padding, gap, corner, border, text: add no class for these.

## API reference

### Parts

- `CreateDialogSection` — A part of the create dialog under its description (milestones, sub-tasks), a row of the card; its props: create-dialog--section.md

- data-slot values (to select a part by): create-dialog, create-dialog-body, create-dialog-chip, create-dialog-chip-words, create-dialog-close, create-dialog-description, create-dialog-draft, create-dialog-error, create-dialog-foot, create-dialog-foot-end, create-dialog-head, create-dialog-mark, create-dialog-more, create-dialog-properties, create-dialog-property, create-dialog-row-icon, create-dialog-section, create-dialog-section-header, create-dialog-section-heading, create-dialog-status, create-dialog-submit, create-dialog-submit-top, create-dialog-summary, create-dialog-trigger

### CreateDialog: every option

```tsx
import { CreateDialog } from '@/components/goop/patterns/create-dialog';
```

### Compose

- A `date` property's value reaches `onCreate` as the day, `YYYY-MM-DD`, in `values.properties[name]` (`''` when none is chosen); a choice's option may carry `status`, one of the six kinds (`'todo'`, `'in-progress'`, …) or your own `{ name, icon, variant }`, as StatusMark takes. There is no property for typed words: the title is the one thing typed, a second short word (a contact's email) may take the summary's place (`summaryPlaceholder="Email"`), and the rest is typed on the record's page once it is made. Each opening starts from the `defaultValues` given at that moment (no `key` or remount needed), unless typed words were kept as a draft.

### Options

- open?: boolean — Open, held by the caller; pair with `onOpenChange`.
- defaultOpen?: boolean = false — Open at first, when the dialog holds its own open state.
- onOpenChange?: (open: boolean) => void — Called as it opens and closes (Escape, a press outside, the close button, a create).
- modal?: boolean = true — The page held behind it while open; `false` for a picture held open beside the page.
- trigger?: ReactNode — The control that opens it (the theme's Button), wrapped as the dialog's trigger.
- heading: ReactNode — The dialog's name ("New project"): read out as it opens, and shown in the header row on a phone.
- context?: ReactNode — The team or space the thing is made in, first in the foot (the theme's Select chip, or a Badge).
- titleLabel?: string = 'Title' — The title field's name for assistive technology (`"Project name"`); "Title" when left out.
- titlePlaceholder?: string — The title field's placeholder.
- summaryPlaceholder?: string | null = 'Add a short summary…' — The one-line summary's placeholder; `null` leaves the summary out.
- descriptionPlaceholder?: string = 'Write a description…' — The description's placeholder.
- properties?: readonly CreateDialogProperty[] = []
- chips?: ReactNode — The caller's own controls in the foot, after the `context` (the theme's quiet IconButtons, a chip).
- sections?: ReactNode — Rows under the description: `CreateDialogSection`s (milestones, sub-tasks), each with its add button.
- attach?: ReactNode — In the foot, after the `chips`: an attach button (the theme's quiet IconButton) and its file input.
- submitLabel?: string = 'Create' — The main button's words ("Create project"); "Create" when left out.
- defaultValues?: Partial<CreateDialogValues> — The values a fresh dialog opens with: the title, a property's value from where it was opened (a list group's status).
- draftKey?: string — Where the silent draft is kept between openings and page loads (the browser's local storage); none: this mount only.
- createMore?: boolean — "Create more" on: a create keeps the dialog open for the next.
- defaultCreateMore?: boolean = false — "Create more" at first, when the dialog holds it (off when left out).
- onCreateMoreChange?: (on: boolean) => void — Called as "Create more" is switched; keep it where the person comes back to it.
- createMoreLabel?: string = 'Create more' — The switch's words; "Create more" when left out.
- onCreate?: (values: CreateDialogValues) => unknown — Makes the thing: return a promise for a save the dialog waits on; throw or reject to keep it open with the error.
- announce?: (values: CreateDialogValues) => string — What is said aloud after a create that keeps the dialog open; "<title> created" when left out.
- container?: HTMLElement | null — Where the layer, and each property's list, is portalled; the end of `<body>` when left out.
- Takes every prop of DialogContent but children, title, variant, onOpenAutoFocus and defaultValue (its page: dialog.md)
- State: open (open / defaultOpen / onOpenChange); createMore (createMore / defaultCreateMore / onCreateMoreChange)
- Types: CreateDialogProperty = CreateDialogChoiceProperty | CreateDialogPersonProperty | CreateDialogLabelsProperty | CreateDialogDateProperty | CreateDialogNumberProperty

### CreateDialogSection

A part of the create dialog under its description (milestones, sub-tasks), a row of the card.

```tsx
import { CreateDialogSection } from '@/components/goop/patterns/create-dialog';
```

### Options

- heading: ReactNode — The part's name ("Milestones").
- action?: ReactNode — A control at the heading's end: the add button.

## Keyboard

- Escape: close, keeping typed words as a draft
- Enter: in the title or the summary, move to the next field
- Meta+Enter: create
- Control+Enter: create
- Tab: move to the next field, property or button

## Accessibility

- The native element answers the keyboard.

## 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.

## Related

- [Create row](/themes/meadow/components/create-row): A new item made in place in a list.
- [Button](/themes/meadow/components/button): A button with words that runs an action, in several looks and sizes, on a page, in a row or in a sidebar.
- [Invite dialog](/themes/meadow/components/invite-dialog): Send an invite to people by their email addresses, with a role and an optional note.
- [Gantt](/themes/meadow/components/gantt): A timeline of dated bars for a roadmap, a schedule or a release plan.
