Input
A single line field with clear labels and useful states.
Rename in place: the text becomes a field without moving.
npx shadcn@latest add @silicon-ui/inline-editnpx shadcn@latest add @silicon-ui/inline-editInstall the dependencies.
npm install lucide-react motionCopy these files into your project. Shared files are skipped if you already have them.
components/silicon-ui/inline-edit/inline-edit.tsxcomponents/silicon-ui/inline-edit/inline-edit.module.cssInstall the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation
| Prop | Type | Default |
|---|---|---|
value*The saved value. A new value from outside replaces the text while it is not being edited. | string | — |
onSave*Persists the new value. Return a promise to show the saving state, and reject it to roll back. | (next: string) => void | Promise<unknown> | — |
label*Accessible name, for example “Project name”. | string | — |
validateReturns a message when the draft cannot be saved. | (next: string) => string | null | undefined | — |
placeholderShown when the value is empty. | string | "" |
multilineWraps onto several lines and grows in height. Enter still saves; Shift+Enter adds a line break. | boolean | false |
variant`title` for names and headings, `body` for descriptions. | "title" | "body" | "title" |
asThe element that holds the text, so a title can stay a heading. | "span" | "p" | "h1" | "h2" | "h3" | "span" |
className | string | — |