component

Editable

props · 29 shown · 29 total

Content

  • string

    Accessible name of the field (e.g. "Task title"). Also prefixes the control buttons' labels.

  • EditableLabels

    Accessible labels of the control buttons.

  • string

    Text shown (muted) when the value is empty.

Data

  • string

    Form field name: renders a hidden `<input>` carrying the committed value.

State

  • boolean
    default false

    Start in edit mode.

  • string
    default ""

    The initial committed text when `value` isn't passed.

  • boolean
    default false

    Disable editing; the preview is dimmed and not focusable.

  • boolean

    Whether the component is editing. Pass it to control edit mode.

  • boolean
    default false

    Mark the field invalid (red edit border, `aria-invalid`).

  • boolean
    default false

    Show the value without allowing edits.

  • string

    The committed text. Pass it to control the value; the component still owns the draft while editing and adopts a changed `value`.

Appearance

  • "none" "subtle"
    default "subtle"

    Hover / editing tint. `none` for rows that paint their own hover.

  • boolean
    default false

    Show an edit button beside the preview (on hover / focus) and save / cancel buttons while editing.

  • "seamless" "field"
    default "seamless"

    How edit mode looks: `seamless` turns the text editable in place (no border or fill); `field` shows an input box, for form-like rows.

  • boolean
    default false

    Sit inline with the surrounding text instead of taking the line.

Layout

  • boolean
    default true

    Pull the hover / edit box outward by its padding, so the text lines up with the content around it (a title with its meta row, a word in a sentence). Turn it off at an edge with no room for the box (an edge-to-edge row, an `overflow: hidden` cell).

Behavior

  • "click" "dblclick" "focus" "none"
    default "click"

    What enters edit mode from the preview.

  • number

    Maximum number of characters.

  • boolean
    default false

    Allow line breaks: Enter inserts a newline and Mod+Enter (⌘/Ctrl+Enter) submits. Single-line text still wraps; newlines are stripped.

  • boolean
    default true

    Submitting an empty (or whitespace-only) draft reverts to the previous value instead of committing it.

  • "caret" "all" "end"
    default "caret"

    Where the caret lands when editing starts.

  • "none" "both" "enter" "blur"
    default "both"

    What commits the draft.

Events

  • (editing: boolean, reason?: EditableEndReason) => void

    Called when edit mode starts or ends.

  • (draft: string) => void

    Called with the draft on every edit keystroke.

  • (value: string) => void

    Called with the new value when a submit changes it.

  • (value: string) => void

    Called with the kept value when an edit is cancelled or an empty draft reverts.

Advanced

  • element binding svelte
    HTMLSpanElement null

    Bound reference to the root element (`bind:this`).

  • EditablePassThrough<RootElementAttributes>

    Per-slot style and HTML-attribute overrides.

  • boolean
    default false

    Astro / vanilla: serialize the props into `data-editable-config` so the client runtime hydrates this instance and `getPindoba(el, "editable")` can `update()` it. Frameworks with their own reactivity don't need it.

Plus all standard <span> HTML attributes.

Type

  • Components
  • Blocks