Inline Edit
Rename in place, built with definePrimitive on UI SDK's createInlineEdit: a press, Enter, F2 or typing turns the text into a field; Enter and Tab save, Escape puts it back, blur saves or cancels; validate keeps editing; agents rename(text) and cancel.
Example
Rename Project namePress Enter or F2 to rename
- Press Enter or F2 to rename
- Press Enter or F2 to rename
- Press Enter or F2 to rename
inline-edit-demo.tsxCopy code
Installation
Copy code
npm packages
lucide-reactUsage
ImportCopy code
Reach for it to rename a title, a list item or a tab without a dialog; a Form or FormDialog for anything with more than one field.
API reference
InlineEdit
| Prop | Type | Default |
|---|---|---|
labelrequiredNames the group, and the field while editing. | string | – |
editButtonA pencil button beside the text. @defaultValue true | boolean | true |
childrenWhat the text shows, when it isn't the value itself. | ReactNode | – |
labels | Partial<InlineEditLabels> | – |
sizeShared by the field, so nothing moves when editing starts. | "body" | "title-sm" | "title" | "body" |
Also takes InlineEditRoot except children.
Other exports
inlineEditInlineEditDisplayInlineEditInputInlineEditRootInlineEditTriggerinlineEditLabelstype InlineEditOptionstype InlineEditReasontype InlineEditLabelstype InlineEditPropstype InlineEditSizeAccessibility
- The text is a button described by the hint; the field is named by label; Enter and Escape return focus to the text.
- Escape inside the field never closes a dialog around it; validate keeps the field open on an invalid name.
- The edit button is an icon button with its name in a tooltip, always visible on touch screens.
Agent actions
Agents find it by its label and call rename with the new text, or cancel an edit in progress.
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.