structyl

Editable

stable

Inline-editable text that swaps between preview and input.

Basic usage

Click to edit

Examples

Inline title editing

Use Editable for a task or document title that the user can rename in place.

Untitled document

Click to rename

Inline editing states

Editable swaps preview and input surfaces for titles, labels and metadata.

Q2 growth report
Click to rename

Features

  • Click to edit.
  • Enter / blur submit modes.

Installation

bash
pnpm dlx structyl add editable

API Reference

Editable.Root

Inline-editable text.

PropTypeDefault
valuestring

Controlled value.

onValueChange(value: string) => void

Called when committed.

submitMode'enter' | 'blur' | 'both'

How edits are committed.

'both'
onSubmit(value: string) => void

Called on commit.

Editable.Preview

The read-only display.

PropTypeDefault

Editable.Input

The edit field.

PropTypeDefault
Editable | structyl