Inline edit

Free

A name you rename in place: plain text until clicked, then a field in the same box; Enter saves with a drawn tick and Esc puts the old text back.

npx shadcn@latest add https://pixilui.com/r/inline-edit.json

Preview

Rename in place: Enter saves with a tick, Esc puts it back.
List

When to use

Use it when

  • Renaming a run, an agent or a file where it is listed.

Use something else when

  • A form field: use Input.

Installation

Terminal
npx shadcn@latest add https://pixilui.com/r/inline-edit.json

Adds inline-edit.tsx with field.tsx, and installs clsx and tailwind-merge. The URL works in any app with a components.json, with no registry to add first.

Usage

example.tsx
import { InlineEdit } from "@/components/pixilui/inline-edit";

<InlineEdit aria-label={aria-label} onSave={onSave} />

Fills its container's width; the label row and the message wrap.

API reference

PropTypeDefault
aria-labelRequiredstring–What the text is, for screen readers ("Run name"): the row shows no label.
valuestring–The saved text, controlled. Pair with onSave.
defaultValuestring""The starting text when uncontrolled.
onSave(value: string) => void | Promise<void>–Runs with the new text when an edit is saved with a change.
editIconReactNode–The pencil that fades in on hover (the animated edit icon).
savedIconReactNode–The tick shown after a save (the animated done icon draws it).
classNamestring–Classes for the field. Native attributes and the ref go to the input.

Also takes every native <input> attribute except size, value, defaultValue, onChange, readOnly, and a ref.

Keyboard

Enter F2On the focused row, starts editing with the text selected.
EnterSaves.
EscPuts the old text back.

Accessibility

  • Named by its aria-label; read-only until editing, so it reads as text.

Motion

  • The pencil fades in on hover (150ms); the field's surface comes and goes in 150ms; on save the done icon draws its tick for 1.6s.
InputA field that checks what you typed and says what's wrong in words.
FieldOne field frame: a rim you can see, and words that say what's wrong.
AI fieldA still gradient rim marks the field that asks the agent.

PixilUI Pro opens soon. The first 20 licenses are $99.