Inline edit
v0.69.0, changelogBetaText that reads as plain text until it is edited in place: a click, Enter or F2 turns it into a field of the same size, Enter or leaving the field saves, Esc puts the text back.
Title
Install
npx shadcn add @syncrobotic/inline-edit Also installs: @syncrobotic/cn, @syncrobotic/input
Overview
When to use
- A page's title the viewer may rename, in the top bar:
action-rail-shelltakesonTitleChange. - A dataset's, run's or robot's name in its page header or a card's title.
More examples
States and real uses. Each example is also a Storybook story and a visual regression test.
Card title
Usage rules
- For one short name renamed where it is shown: a page title, a dataset or a robot's name. A form's fields stay Inputs with labels; never a page of these.
- At rest it is the text itself: no edge and no icon, only the hover fill. Give it the type of the text it replaces through
className, so the field opens at the same size and nothing moves. - An empty or unchanged value saves nothing. Check the name in
onChange, and say why a rejected one was refused in a toast, keeping the old name. labelsays what editing does (Rename dataset): it names the field and describes the text at rest.
Changelog
- 0.69.02026-12-03New: a name or title renamed where it is shown (a page title, a dataset name), controlled by
valueandonChange.