npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-create-dialog.json --yesCreate dialog
ProA dialog to make a new record, title first, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- CreateDialogSectionA part of the create dialog under its description (milestones, sub-tasks)
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]);
}}
/>
);
}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 aperson,labels, a targetdate, an amount typed as anumberwith itscurrency, 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. InonCreate, 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.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-create-dialog.json --yesAdd the Goop Create dialog to this project. The install steps are at https://goop.so/docs/install.mdUsage
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
- Each option with its sentence: create-dialog--options.md
- 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
| Part | What it is |
|---|---|
| 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
import { CreateDialog } from '@/components/goop/patterns/create-dialog';Compose
- A
dateproperty's value reachesonCreateas the day,YYYY-MM-DD, invalues.properties[name](''when none is chosen); a choice's option may carrystatus, 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 thedefaultValuesgiven at that moment (nokeyor 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).
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
| Key | What it does |
|---|---|
| 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.
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| 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.