X Enterprises
nuxt-x-app

Inline

Inline editing components that let users edit field values in place with optimistic updates and automatic API persistence.

Inline

The Inline category provides click-to-edit field components for detail views and data tables. Each component follows the same pattern: display mode (read-only with a subtle hover affordance) → edit mode → optimistic save via useXCrud → success/error indicator. All rollback on API failure.

Components

<XAInlineEdit />

Renders a value inline. On click, reveals a text input. On Enter or blur, sends a PATCH to the configured endpoint. Shows a spinner while saving, a green check on success, and a red error icon (with tooltip) on failure.

<XAInlineEdit
  v-model="contact.name"
  field="name"
  endpoint="/api/contacts"
  :entity-id="contact.id"
  type="text"
  placeholder="Enter name..."
  display-class="font-medium"
  @save="onSaved"
  @error="onError"
/>

Props

PropTypeDefaultDescription
modelValueString | NumbernullCurrent field value (v-model)
fieldStringrequiredField name to update in the API payload
endpointStringrequiredAPI endpoint passed to useXCrud
entityIdString | NumberrequiredRecord ID for the PATCH request
type'text' | 'number' | 'email' | 'tel' | 'url''text'Input type
placeholderString'Click to edit'Placeholder shown in display and edit modes
displayClassString''Additional CSS classes for the display span
inputClassString''Additional CSS classes for the input element
formatterFunctionnullOptional function to transform the display value

Emits

EventPayloadDescription
update:modelValueString | NumberOptimistic value update
savenewValue, previousValueSave succeeded
errorErrorSave failed

<XAInlineToggle />

A USwitch that immediately PATCHes a boolean field on toggle. Optimistically updates the value then reverts on API failure. Shows a text label next to the switch that reflects the current state.

<XAInlineToggle
  v-model="record.isActive"
  field="isActive"
  endpoint="/api/records"
  :entity-id="record.id"
  true-label="Active"
  false-label="Inactive"
  :show-label="true"
  size="sm"
  @save="onToggled"
/>

Props

PropTypeDefaultDescription
modelValueBooleanfalseCurrent boolean value (v-model)
fieldStringrequiredField name to update
endpointStringrequiredAPI endpoint for useXCrud
entityIdString | NumberrequiredRecord ID
trueLabelString'Yes'Label text when value is true
falseLabelString'No'Label text when value is false
showLabelBooleantrueShow text label next to switch
labelClassString'text-sm'Additional CSS classes for the label
size'xs' | 'sm' | 'md' | 'lg''sm'Switch size

Emits

EventPayloadDescription
update:modelValueBooleanOptimistic value update
savenewValue, previousValueSave succeeded
errorErrorSave failed

<XAInlineSelect />

Displays the current option value (as a badge if the option has a color). On click, opens a USelectMenu. Saves immediately on selection change.

<XAInlineSelect
  v-model="task.status"
  field="status"
  endpoint="/api/tasks"
  :entity-id="task.id"
  :options="[
    { value: 'todo', label: 'To Do', color: 'neutral' },
    { value: 'in_progress', label: 'In Progress', color: 'warning' },
    { value: 'done', label: 'Done', color: 'success' },
  ]"
  value-key="value"
  label-key="label"
  placeholder="Select status..."
  @save="onStatusChanged"
/>

Props

PropTypeDefaultDescription
modelValueString | Number | BooleannullCurrent value (v-model)
fieldStringrequiredField name to update
endpointStringrequiredAPI endpoint for useXCrud
entityIdString | NumberrequiredRecord ID
optionsArrayrequiredOptions array (objects or primitives)
valueKeyString'value'Key used as the option value
labelKeyString'label'Key used as the display label
placeholderString'Select...'Placeholder text
displayClassString''Additional CSS classes for the display span
selectClassString''Additional CSS classes for the select menu

Emits

EventPayloadDescription
update:modelValueString | Number | BooleanOptimistic value update
savenewValue, previousValueSave succeeded
errorErrorSave failed

<XAInlineDate />

Displays a formatted date inline with a calendar icon. On click, opens a popover with a native <input type="date"> plus Clear/Cancel/Save buttons. Saves on the Save button click.

<XAInlineDate
  v-model="task.dueDate"
  field="dueDate"
  endpoint="/api/tasks"
  :entity-id="task.id"
  placeholder="Set due date..."
  :show-icon="true"
  :date-format="{ dateStyle: 'medium' }"
  @save="onDateSaved"
/>

Props

PropTypeDefaultDescription
modelValueString | DatenullCurrent date value (v-model)
fieldStringrequiredField name to update
endpointStringrequiredAPI endpoint for useXCrud
entityIdString | NumberrequiredRecord ID
placeholderString'Select date...'Placeholder shown when no date is set
displayClassString''Additional CSS classes for the display span
showIconBooleantrueShow calendar icon in display mode
dateFormatObject{ dateStyle: 'medium' }Intl.DateTimeFormat options for the display value

Emits

EventPayloadDescription
update:modelValueString | DateOptimistic value update
savenewValue, previousValueSave succeeded
errorErrorSave failed

AI Context

category: Inline
package: "@xenterprises/nuxt-x-app"
components:
  - XAInlineEdit
  - XAInlineToggle
  - XAInlineSelect
  - XAInlineDate
use-when: >
  Detail/show pages where users should be able to edit individual fields
  without navigating to a separate edit form. Great for status fields,
  boolean flags, names, dates, and any field that benefits from immediate
  in-context editing.
key-patterns:
  - All inline components require field, endpoint, and entityId props
  - All use useXCrud internally — no manual API call needed
  - All perform optimistic updates and revert on failure
  - Use v-model to keep the parent state in sync
  - XAInlineSelect shows a colored badge in display mode when options have a color key
Copyright © 2026