Skip to content

Inline edit

Edits text in place and keeps the draft when the save fails.

Title
inline-edit-basic-demo.tsx

Installation

The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.

Disabled

Owner
inline-edit-disabled-demo.tsx

Empty value

Description
inline-edit-empty-demo.tsx

Save error

Return a promise from onSave to show progress. Throw to keep the editor open with the message.

Title
inline-edit-demo.tsx

API reference

vip/ui adds or changes the props below. For all other props, see React Aria TextField (opens in a new tab).

label: stringRequired
Visible label in display and edit modes.
value: string
The saved value, controlled.
defaultValue: string = ""
The saved value at first, uncontrolled.
placeholder: string = "Not set"
Text shown when the value is empty.
onSave: (value: string) => void | Promise<void>
Called when you save a changed value. While its promise is pending, the save button shows a spinner. If it throws, the editor stays open and shows the error message. When controlled, update value here.
isDisabled: boolean = false
Prevents opening the editor.