Inline edit

Playground

Properties

Size
Variant
Line
Error
Disabled

Content

Text

Usage

onValueChange reports edits, and onCommit reports the committed value. To let Escape restore the previous value, keep the committed value in value and update it in onCommit. Moving focus outside the editor also commits the edit.

'use client';
import { useState } from 'react';
import { InlineEdit } from '@mbsw/ui';

export default function Example() {
  const [title, setTitle] = useState('title');
  return (
    <InlineEdit
      value={title}
      onCommit={setTitle}
      editLabel={"Edit title"}
      cancelLabel={"Cancel editing"}
      clearLabel={"Clear title"}
    />
  );
}

The Playground Code tab includes the full example with your current settings. See Installation for the CSS imports.

Composition