Skip to Content
Docs
Edit and act

Inline editing

Edit a typed cell with validation and a real update action.

Inline editing is a focused alternative to opening a form for every small change. Enable it for fields that have a clear editor and a safe patch contract.

Configuration example

Start from the React quick start or Vue quick start. The following file extends their product catalog. Pass this configuration through getTableConfig in React or config in Vue.

stock-config.ts
import { defineTableConfig } from "@/components/ui/yayaw-table/config/helpers";
import { productConfig } from "./product-config";

export const stockConfig = defineTableConfig({
  ...productConfig,
  columns: {
    ...productConfig.columns,
    definitions: productConfig.columns.definitions.map((column) =>
      column.id === "stock"
        ? {
            ...column,
            inlineEdit: { enabled: true, editor: "number" },
            defaultCalculation: "sum",
          }
        : column
    ),
  },
  table: {
    ...productConfig.table,
    allowInlineEdit: true,
    allowEdit: true,
    enableCalculations: true,
    inlineEdit: { enabled: true, debounceMs: 400, optimistic: true },
    rowClickMode: "none",
  },
});
stock-config.ts
import { defineTableConfig } from "@/components/ui/yayaw-table-vue/config";
import { productConfig } from "./product-config";

export const stockConfig = defineTableConfig({
  ...productConfig,
  columns: {
    ...productConfig.columns,
    definitions: productConfig.columns.definitions.map((column) =>
      column.id === "stock"
        ? {
            ...column,
            inlineEdit: { enabled: true, editor: "number" },
            defaultCalculation: "sum",
          }
        : column
    ),
  },
  table: {
    ...productConfig.table,
    allowInlineEdit: true,
    allowEdit: true,
    enableCalculations: true,
    inlineEdit: { enabled: true, debounceMs: 400, optimistic: true },
    rowClickMode: "none",
  },
});

Wire validation and persistence

Supply getFormConfig with the field schema and getTableActions with update. A stock field should reject negative numbers and fractions both in the form and at the write boundary. fieldErrors maps server validation messages to field names. The stock recipe includes the complete adapter and schema.

Editor behavior

A click anywhere in the cell, or Enter, starts the supported cell editing flow; a link shown in the cell keeps opening. editor can explicitly choose text, number, select, multiSelect, boolean, date, JSON or URL behavior. formField maps a displayed column to a differently named form field. Read-only columns remain protected even when table-wide editing is enabled.

A boolean cell toggles on that first click and saves the new value, so one click checks or unchecks it. React then keeps its switch open until the autosave delay or dismissal; Vue saves at once, as its checkbox does.

Local single-value inline editors in React and Vue use the themed Select dropdown. Vue’s sort/group property pickers also use themed Select controls. Clicking a cell or pressing Enter opens its list immediately. Choosing an option preserves its original value type and saves once; Escape cancels the edit. Vue reuses the record form Select, built on the Reka primitives used by shadcn-vue, rather than an operating-system menu. No additional dependency or consumer configuration is required.

A select or multiSelect form field with searchOptions edits in the cell too: typing at least searchMinLength characters searches the server after searchDebounceMs, and the list shows its results even when their label lacks the typed text. Picking a value saves a single select at once; a multiSelect adds a chip and saves on dismissal. Searched choices keep their label and their original type, resolveOptions labels the current values when the editor opens, and a failed search shows its message in the list without losing the draft. Other field types with searchOptions still open the full form.

When the field also has createOption, a search that names no existing option (ignoring case) ends the list with Create "{label}" (inline.create_option). Picking it calls createOption(label, context, signal) with the typed text, and the option it returns must carry a saved value: a multiSelect adds it as a chip and keeps editing, a single select saves it at once. The editor stays open while the creation runs, so createOption can open your own form and resolve with the saved record; a failed creation shows its message in the list without losing the draft.

Editable cells show it before the click. Hovering one shows a pointer cursor and draws a field, the page background with a thin inset border, over the row's hover tint, and a tooltip says "Click or press Enter to edit" (inline.edit_hint). On hover or keyboard focus the cell also shows an icon named after its editor (inlineEditorIcon), in a small chip over the cell's end (its start for right-aligned numbers), so the cell never resizes: a pencil for text, lines for textarea, a chevron for select, a checklist for multiSelect, a tag for tag columns, # for number, a calendar for date (with a clock for datetime), a link for URL, a pin for location and braces for JSON. Boolean cells show none, and a cell with cell actions shows its actions instead. Read-only cells keep the plain row tint, and nothing shows while a cell edits.

Avoid conflicting row gestures

Keep row-click editing off when a click is used for cell editing or a row link. Optimistic updates are provisional until the action succeeds. Test a rejected save and ensure the displayed value and cache return to the last confirmed state.

Enable one editable column

Expose an inline number editor for Price. Reuse productForm and editableActions so zero is accepted and negative prices are rejected by the schema and store.

Copy this complete configuration beside product-config.ts. Use () => exampleConfig as React’s getTableConfig, or :config="exampleConfig" in Vue.

Expand ↗

Sample data. Changes stay in this preview.

Expand ↗

Sample data. Changes stay in this preview.

Protect archived records

Use the row predicate for the interface and repeat authorization in the mutation handler. A hidden editor is not server authorization.

Copy this complete configuration beside product-config.ts. Use () => exampleConfig as React’s getTableConfig, or :config="exampleConfig" in Vue.

Expand ↗

Sample data. Changes stay in this preview.

Expand ↗

Sample data. Changes stay in this preview.