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.
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”activationMode?
Section titled “activationMode?”EditableTextActivationMode = 'single'
How a pointer starts an edit session.
Default
'single'align?
Section titled “align?”Text alignment, matching Text.
aria-label?
Section titled “aria-label?”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'className?
Section titled “className?”string
Additional CSS class name applied to the current root element.
color?
Section titled “color?”TextColor = 'primary'
Text color, matching Text.
Default
'primary'defaultValue?
Section titled “defaultValue?”string
Initial committed value (uncontrolled).
disabled?
Section titled “disabled?”boolean = false
Disable the field entirely — no editing, no hover affordance, not focusable.
Default
falselabels?
Section titled “labels?”Partial<EditableTextLabels>
String overrides for localization. Pass a stable reference (memoize it) — it is low-frequency config.
lineHeight?
Section titled “lineHeight?”Line height, matching Text.
maxLength?
Section titled “maxLength?”number
Maximum number of characters accepted by the edit field.
boolean = false
Use the monospace font family (also implied by variant="code").
onChange?
Section titled “onChange?”(value) => void
Called with the new value when an edit is committed. Fires on commit only (Enter / blur), not on every keystroke.
onEditEnd?
Section titled “onEditEnd?”(reason) => void
Called when an edit session ends, with the reason.
onEditStart?
Section titled “onEditStart?”() => void
Called when an edit session starts.
onKeyDown?
Section titled “onKeyDown?”(event) => void
Key-down handler forwarded to the edit field (runs after built-ins).
placeholder?
Section titled “placeholder?”string
Placeholder shown when the value is empty, both in the display and the edit field. Rendered in the muted placeholder color.
readOnly?
Section titled “readOnly?”boolean = false
Render the value but do not allow editing. Still selectable/focusable.
Default
falseRef<EditableTextHandle>
Imperative handle — see EditableTextHandle.
selectOnEdit?
Section titled “selectOnEdit?”boolean = true
Select the whole value when an edit session starts.
Default
trueText size, matching Text. Overrides the variant size.
style?
Section titled “style?”CSSProperties
Inline styles applied to the current root element.
submitOnBlur?
Section titled “submitOnBlur?”boolean = true
Commit the draft when the edit field loses focus. When false, blurring
discards the draft instead.
Default
truetestId?
Section titled “testId?”string
Test identifier for automated testing.
truncate?
Section titled “truncate?”boolean = false
Truncate the display text with an ellipsis on overflow.
value?
Section titled “value?”string
The committed text value (controlled).
variant?
Section titled “variant?”TextVariant = 'body'
Semantic typography variant, matching Text.
Default
'body'weight?
Section titled “weight?”Text weight, matching Text. Overrides the variant weight.
Returns
Section titled “Returns”ReactElement
Example
Section titled “Example”// 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"/>