Skip to content
Entangle UI v0.13.0

EditableText

EditableText(__namedParameters): ReactElement

Defined in: src/components/primitives/EditableText/EditableText.tsx:60

Text that looks like <Text> but turns into an inline editor when the user activates it — the editor-UI pattern for renaming layers, nodes, assets, and scene objects in place.

The idle state renders a real <Text> (so it inherits every typography prop), and the editing state renders a chrome-less <input> that shares the exact same typography recipe, so the swap is visually seamless. The edit field auto-sizes to its content via a hidden sizer — no measurement effects.

Editing commits on Enter (and on blur when submitOnBlur), cancels on Escape. onChange fires on commit only, with the new value.

EditableTextActivationMode = 'single'

How a pointer starts an edit session.

Default

'single'

TextAlign

Text alignment, matching Text.

string

Explicit accessible name. Wins over the value/placeholder-derived name and over labels.editLabel.

TextElement = 'span'

HTML element rendered for the display (idle) state.

Default

'span'

string

Additional CSS class name applied to the current root element.

TextColor = 'primary'

Text color, matching Text.

Default

'primary'

string

Initial committed value (uncontrolled).

boolean = false

Disable the field entirely — no editing, no hover affordance, not focusable.

Default

false

Partial<EditableTextLabels>

String overrides for localization. Pass a stable reference (memoize it) — it is low-frequency config.

TextLineHeight

Line height, matching Text.

number

Maximum number of characters accepted by the edit field.

boolean = false

Use the monospace font family (also implied by variant="code").

(value) => void

Called with the new value when an edit is committed. Fires on commit only (Enter / blur), not on every keystroke.

(reason) => void

Called when an edit session ends, with the reason.

() => void

Called when an edit session starts.

(event) => void

Key-down handler forwarded to the edit field (runs after built-ins).

string

Placeholder shown when the value is empty, both in the display and the edit field. Rendered in the muted placeholder color.

boolean = false

Render the value but do not allow editing. Still selectable/focusable.

Default

false

Ref<EditableTextHandle>

Imperative handle — see EditableTextHandle.

boolean = true

Select the whole value when an edit session starts.

Default

true

TextSize

Text size, matching Text. Overrides the variant size.

CSSProperties

Inline styles applied to the current root element.

boolean = true

Commit the draft when the edit field loses focus. When false, blurring discards the draft instead.

Default

true

string

Test identifier for automated testing.

boolean = false

Truncate the display text with an ellipsis on overflow.

string

The committed text value (controlled).

TextVariant = 'body'

Semantic typography variant, matching Text.

Default

'body'

TextWeight

Text weight, matching Text. Overrides the variant weight.

ReactElement

// Uncontrolled — click the text to rename in place
<EditableText defaultValue="Untitled Layer" onChange={setName} />
// Controlled, heading-styled, double-click to edit (rename convention)
<EditableText
variant="heading"
value={name}
onChange={setName}
activationMode="double"
placeholder="Name this node"
/>