npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-create-row.json --yesCreate row
ProA new item made in place in a list, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- TableCreateRowA table's row to create a record in place, at its body's foot
- CreateRowTitleThe title field of a table's create row, in its first cell
- CreateRowActionsCancel and Create of a table's create row, in its last cell (
<TableCell align="end">) - useCreateLandingThe create row's landing, for an item a dialog makes
- useCreateRowThe create row's state and the landing of what it creates
import { useCreateLanding, useCreateRow, CreateRow, TableCreateRow, CreateRowTitle, CreateRowActions } from '@/components/ui/goop/create-row';
import { useState } from 'react';
import { ListGroup, ListGroupHeader, ListGroupAction, ListGroupTitle, ListGroupContent } from '@/components/ui/goop/list-group';
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@/components/ui/goop/select';
import { Item, ItemContent, ItemTitle } from '@/components/ui/goop/item';
function Tasks() {
const [tasks, setTasks] = useState([{ id: 1, title: 'Wedge the clay' }]);
const create = useCreateRow({
noun: 'Task',
onCreate: ({ title }) => {
const id = Date.now();
setTasks((all) => [{ id, title }, ...all]);
return id;
},
});
return (
<ListGroup
onAdd={() => create.start({ status: 'To do' })}
createRow={
<CreateRow
{...create.row}
label="New task"
chips={
<Select value={create.values.status} onValueChange={(status) => create.setValue('status', status)}>
<SelectTrigger shape="chip" aria-label={`Status: ${create.values.status ?? 'none'}`}>
<SelectValue />
</SelectTrigger>
<SelectContent aria-label="Status">
<SelectItem value="To do">To do</SelectItem>
<SelectItem value="Done">Done</SelectItem>
</SelectContent>
</Select>
}
/>
}
>
<ListGroupHeader action={<ListGroupAction icon="plus" aria-label="New task in To do" />}>
<ListGroupTitle>To do</ListGroupTitle>
</ListGroupHeader>
<ListGroupContent>
{tasks.map((task) => (
<Item key={task.id} variant="line" {...create.landed(task.id)}>
<ItemContent>
<ItemTitle>{task.title}</ItemTitle>
</ItemContent>
</Item>
))}
</ListGroupContent>
</ListGroup>
);
}In the list look, press a group’s plus (or C with the focus in a group), type a title, pick a status or priority ("No priority" at the top of its list sets it back to none), and press Enter: the task grows in at the top of its group with a soft tint and the row stays ready for the next. Escape keeps what you typed for next time; Ctrl/Cmd+Z in the empty row takes the last task out again. In the table look, the interviews table’s New row opens a row at the table’s foot: Tab walks its cells, Enter adds the interview in its sorted place. The error look shows a row whose save the server refused. The tasks are our own sample, held in the page; nothing is saved.
When to use
- A new item made in place in a list.
When not to use
- For a full form use CreateDialog.
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 row 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-row.json --yesAdd the Goop Create row to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { useCreateLanding, useCreateRow, CreateRow, TableCreateRow, CreateRowTitle, CreateRowActions } from '@/components/ui/goop/create-row';
import { useState } from 'react';
import { ListGroup, ListGroupHeader, ListGroupAction, ListGroupTitle, ListGroupContent } from '@/components/ui/goop/list-group';
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@/components/ui/goop/select';
import { Item, ItemContent, ItemTitle } from '@/components/ui/goop/item';
function Tasks() {
const [tasks, setTasks] = useState([{ id: 1, title: 'Wedge the clay' }]);
const create = useCreateRow({
noun: 'Task',
onCreate: ({ title }) => {
const id = Date.now();
setTasks((all) => [{ id, title }, ...all]);
return id;
},
});
return (
<ListGroup
onAdd={() => create.start({ status: 'To do' })}
createRow={
<CreateRow
{...create.row}
label="New task"
chips={
<Select value={create.values.status} onValueChange={(status) => create.setValue('status', status)}>
<SelectTrigger shape="chip" aria-label={`Status: ${create.values.status ?? 'none'}`}>
<SelectValue />
</SelectTrigger>
<SelectContent aria-label="Status">
<SelectItem value="To do">To do</SelectItem>
<SelectItem value="Done">Done</SelectItem>
</SelectContent>
</Select>
}
/>
}
>
<ListGroupHeader action={<ListGroupAction icon="plus" aria-label="New task in To do" />}>
<ListGroupTitle>To do</ListGroupTitle>
</ListGroupHeader>
<ListGroupContent>
{tasks.map((task) => (
<Item key={task.id} variant="line" {...create.landed(task.id)}>
<ItemContent>
<ItemTitle>{task.title}</ItemTitle>
</ItemContent>
</Item>
))}
</ListGroupContent>
</ListGroup>
);
}- Fits: list: foot.
- Also known as: InlineCreate, QuickAdd, AddRow, NewItemRow, InlineAddForm.
- Reach for it where a list or a table makes its own items: a group's plus, a list page's "New task" open it in place, pre-filled with the group's values, and Enter leaves it ready for the next. A create that needs a description, many properties or an attachment is a dialog's, never this row's.
- TableCreateRow: Reach for it where a table makes its records one after another (a ledger, line items); a record that needs more than a line of fields is a dialog's.
- More on where it goes: create-row--options.md
- height, width, padding, gap, corner, background, text, motion: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| Defaults | open = true |
- Each option with its sentence: create-row--options.md
- Types: UseCreateLandingOptions = { onUndo?: (key: string | number, draft: D) => void | PromiseLike<unknown>; onView?: (key: string | number) => void; noun?: string; toasterId?: string }
| Part | What it is |
|---|---|
| TableCreateRow | A table's row to create a record in place, at its body's foot |
| CreateRowTitle | The title field of a table's create row, in its first cell |
| CreateRowActions | Cancel and Create of a table's create row, in its last cell (<TableCell align="end">) |
| useCreateLanding | The create row's landing, for an item a dialog makes |
| useCreateRow | The create row's state and the landing of what it creates |
CreateRowActions
Cancel and Create of a table's create row, in its last cell (<TableCell align="end">).
import { CreateRowActions } from '@/components/ui/goop/create-row';Options
- createLabel?: string = 'Create' — The words of the create button.
- cancelLabel?: string = 'Cancel' — The words of the cancel button.
- restoredLabel?: string = 'Draft restored' — The words that say a kept draft was put back.
- discardLabel?: string = 'Discard' — The words of the button that empties a restored draft.
CreateRow: every option
import { CreateRow } from '@/components/ui/goop/create-row';Compose
- TableCreateRow: Your editors read and set
create.values(create.setValue(name, value));onCreatereceives{ title, summary, values }, and the row stays open, the title emptied, the values kept. A column markedhide: 'narrow'leaves this row too, so give its value a default; worked: docs/recipe-table-create-row.md.
Options
- label: string — The row's name, read on the form and its title field ("New task").
- icon?: IconName = 'circle-dashed' — The leading glyph, by the pack's name: an empty status's dashed circle by default.
- hideIcon?: boolean = false — Draw no leading glyph, where the list's rows carry no status mark: the title starts on their titles' edge.
- placeholder?: string — The title's placeholder ("Task title").
- summaryPlaceholder?: string — Draws the summary field after the title, with this placeholder.
- chips?: ReactNode — The property chips, after the words: the theme's
Selects on aSelectTrigger shape="chip". - createLabel?: string = 'Create' — The words of the create button.
- cancelLabel?: string = 'Cancel' — The words of the cancel button.
- restoredLabel?: string = 'Draft restored' — The words that say a kept draft was put back.
- discardLabel?: string = 'Discard' — The words of the button that empties a restored draft.
- retryLabel?: string — The words of a failed save's retry (Try again).
- Defaults: open = true
TableCreateRow
A table's row to create a record in place, at its body's foot.
import { TableCreateRow } from '@/components/ui/goop/create-row';Options
- label: string — The row's name, read on the row and its title field ("New invoice").
- onStart?: () => void — Opens the row: the closed row's button calls it (
create.start()). - startLabel?: string = 'New row' — The closed row's button's words.
- children: ReactNode — One
TableCellper column: the first holdingCreateRowTitle, the lastCreateRowActions, the others your editors.
CreateRowTitle
The title field of a table's create row, in its first cell.
import { CreateRowTitle } from '@/components/ui/goop/create-row';Options
- retryLabel?: string — The words of a failed save's retry (Try again).
- Also takes: defaultValue?: string; name?: string; required?: boolean; disabled?: boolean; form?: string
Keyboard
| Key | What it does |
|---|---|
| Enter in the title or the summary | Create the item; the row stays open, emptied, its chips kept, the title focused (unless the caller closes it) |
| Ctrl/Cmd+Enter anywhere in the row | Create the item |
| Escape | Close the row; typed words are kept as a draft the next open restores; the focus goes back to what opened it |
Accessibility
- The part itself answers the keys above.
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.