/v1.0

EditableLongTextField

EditableLongTextField is an inline-editable multiline text area. In read mode the current value is displayed in a disabled textarea. Clicking the edit icon unlocks it for typing. The edit controls (save / cancel) are positioned to the right of the textarea. On save the new value is persisted via API.

Props

| Prop | Type | Required | Default | Description | |------|------|----------|---------|-------------| | name | string | Yes | — | Field name sent as the key in the update payload. | | value | string | Yes | "" | Current multiline text value. | | updatePath | string | Yes | — | API endpoint path used to persist the change. | | label | string | No | — | Label shown above the textarea. | | description | string | No | — | Helper text shown below the label. | | placeholder | string | No | — | Placeholder shown inside the textarea when empty. | | apiBaseUrl | string | No | — | Base URL prepended to updatePath. | | useAuthToken | boolean | No | false | When true, the request includes the authorization token. | | onEditStart | () => void | No | — | Called when edit mode begins. | | onEditSuccess | (updatedValue: string, newFormData: any) => void | No | — | Called after successful save. | | onEditError | (error: any) => void | No | — | Called on API error; value is reverted. | | onEditCancel | () => void | No | — | Called when the user cancels; value is reverted. | | editIcon | string | No | "pencil" | Icon name for the edit button. | | saveIcon | string | No | "check" | Icon name for the save button. | | cancelIcon | string | No | "close" | Icon name for the cancel button. | | containerStyle | React.CSSProperties | No | — | Style for the outermost wrapper div. | | inputStyle | React.CSSProperties | No | — | Style for the <textarea> element. | | labelStyle | React.CSSProperties | No | — | Style for the <label> element. | | descriptionStyle | React.CSSProperties | No | — | Style for the description <p> element. |

Usage

Basic

import React, { useState } from 'react';
import EditableLongTextField from '@/components/editable-fields/EditableLongTextField';

export default function Example() {
  const [bio, setBio] = useState('A short biography...');

  return (
    <EditableLongTextField
      label="Biography"
      name="bio"
      value={bio}
      updatePath="/v1/users/42"
      apiBaseUrl="https://api.example.com"
      useAuthToken
      onEditSuccess={(updated) => setBio(updated)}
    />
  );
}

With placeholder and description

<EditableLongTextField
  label="Notes"
  description="Internal notes visible only to staff."
  placeholder="Add notes here..."
  name="notes"
  value={notes}
  updatePath="/v1/orders/99"
  apiBaseUrl="https://api.example.com"
  useAuthToken
  onEditSuccess={(updated) => setNotes(updated)}
/>