Skip to content
Eskais UI

Forms

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

Installation

npx shadcn@latest add @eskais/inline-edit
npm packageslucide-react

Usage

Import
import { inlineEdit } from "@/components/ui/inline-edit-primitive"import {  InlineEdit,  InlineEditDisplay,  InlineEditInput,  InlineEditRoot,  InlineEditTrigger,  inlineEditLabels,} from "@/components/ui/inline-edit"

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

PropTypeDefault
labelrequiredNames the group, and the field while editing.string–
editButtonA pencil button beside the text. @defaultValue truebooleantrue
childrenWhat the text shows, when it isn't the value itself.ReactNode–
labelsPartial<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 InlineEditSize

Accessibility

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