X Enterprises
Composables

useXInlineEdit

In-place cell editing state for tables — tracks the editing cell, pending changes, and save/cancel lifecycle.

useXInlineEdit

State machine for inline (in-place) cell editing in tables. Tracks which cell is being edited, buffers pending changes, and runs your onSave callback when an edit is committed. Powers XATableEditableCell and the XAInline* components.

Usage

const { editingCell, isSaving, startEdit, stopEdit, saveEdit, cancelEdit, isEditing } = useXInlineEdit({
  onSave: async (rowId, field, value) => {
    await $fetch(`/api/users/${rowId}`, {
      method: 'PATCH',
      body: { [field]: value },
    })
  },
})

Options

OptionTypeDescription
onSave(rowId, field, value, originalValue) => Promise<void> | voidCalled when an edit is saved.
onCancel(rowId, field) => voidCalled when an edit is cancelled.
onError(error, rowId, field) => voidCalled when a save fails.

Returns

KeyTypeDescription
editingCellRef<EditingCell | null>The cell currently being edited (rowId, field, value, originalValue).
isSavingRef<boolean>true while onSave is in flight.
pendingChangesRef<Map<string, EditingCell>>Buffered edits not yet saved.
isEditing(rowId, field) => booleanWhether a specific cell is being edited.
startEdit / stopEditfunctionsEnter/exit edit mode for a cell.
saveEdit / cancelEditfunctionsCommit (runs onSave) or discard the current edit.

AI Context

composable: useXInlineEdit
package: "@xenterprises/nuxt-x-app"
use-when: Building click-to-edit table cells or inline field editing with a save/cancel lifecycle.
Copyright © 2026