---
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. 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 land it — the create row's own landing, `useCreateLanding`: `land(key, values, { focus: !createMore })` grows it in with its tint and, as the dialog closes, scrolls it into view and focuses 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>/trail-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 { CreateDialog, CreateDialogSection } from '@/components/goop/patterns/create-dialog';
import { useState } from 'react';
import { Button, ButtonIcon, ButtonLabel } from '@/components/ui/goop/button';

function NewProject() {
  const [projects, setProjects] = useState<string[]>([]);
  const [more, setMore] = useState(false);
  return (
    <CreateDialog
      trigger={
        <Button>
          <ButtonIcon icon="plus" />
          <ButtonLabel>New project</ButtonLabel>
        </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: 'labels', name: 'labels', label: 'Labels', options: [{ value: 'ux', label: 'UX' }] },
        { 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) => {
        // your save; throw to keep the dialog open, the message shown in it
        // the Budget chip's number: values.numbers.budget (number | null), never values.properties
        if (projects.includes(values.title)) throw new Error(`There is a project called ${values.title} already.`);
        setProjects((now) => [values.title, ...now]);
      }}
    />
  );
}
```

- Fits: board (its recipe); 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)

- data-slot values (to select a part by): create-dialog, create-dialog-chip, create-dialog-draft, create-dialog-error, create-dialog-more, create-dialog-section, create-dialog-section-header, create-dialog-section-heading, create-dialog-status, create-dialog-step, 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
- defaultOpen?: boolean = false
- onOpenChange?: (open: boolean) => void
- modal?: boolean = true
- trigger?: ReactNode
- heading: ReactNode
- context?: ReactNode
- titleLabel?: string = 'Title'
- titlePlaceholder?: string
- summaryPlaceholder?: string | null = 'Add a short summary…'
- descriptionPlaceholder?: string = 'Write a description…'
- properties?: readonly CreateDialogProperty[] = []
- chips?: ReactNode
- sections?: ReactNode
- attach?: ReactNode
- submitLabel?: string = 'Create'
- defaultValues?: Partial<CreateDialogValues>
- draftKey?: string
- createMore?: boolean
- defaultCreateMore?: boolean = false
- onCreateMoreChange?: (on: boolean) => void
- createMoreLabel?: string = 'Create more'
- onCreate?: (values: CreateDialogValues) => unknown
- announce?: (values: CreateDialogValues) => string
- container?: HTMLElement | null
- 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); drawn by data-focus-visible
- Types: CreateDialogProperty = CreateDialogChoiceProperty | CreateDialogPersonProperty | CreateDialogLabelsProperty | CreateDialogDateProperty | CreateDialogNumberProperty

Shortened to fit; what went is in agent/ship/manifest.json.

### CreateDialogSection

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

```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, chip or button

## Accessibility

- The part itself answers the keys above.
- focus-visible: the attribute data-focus-visible

## 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/trail/components/create-row): A new item made in place in a list.
- [Button](/themes/trail/components/button): A button with words that runs an action, in several looks and sizes.
- [Invite dialog](/themes/trail/components/invite-dialog): Send an invite to people by their email addresses, with a role and an optional note.
- [Auth page](/themes/trail/components/auth-page): A page outside the app frame, for a person not yet inside the app.
