Components
Editable

Editable

Editable is an input field used for editing a single line of text. It renders as static text and transforms into a text input field when then edit interaction is triggered (click, focus, or double-click).

API reference docs for the component. Learn about the props, CSS, and other APIs of this exported module.

EditableProps

activationMode

ActivationMode

The activation mode for the preview element. - "focus" - Enter edit mode when the preview element is focused - "dblclick" - Enter edit mode when the preview element is double-clicked - "none" - No interaction with the preview element will trigger edit mode.

autoResize

boolean

Whether the editable should auto-resize to fit the content.

defaultValue

string

dir

'ltr' | 'rtl'

The document's text/writing direction.

disabled

boolean

Whether the editable is disabled

finalFocusEl

() => HTMLElement | null

The element that should receive focus when the editable is closed. By default, it will focus on the trigger element.

form

string

The associate form of the underlying input.

getRootNode

() => ShadowRoot | Node | Document

A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.

id

string

The unique identifier of the machine.

ids

Partial<{ root: string area: string label: string preview: string input: string controls: string submitTrigger: string cancelTrigger: string editTrigger: string }>

The ids of the elements in the editable. Useful for composition.

invalid

boolean

Whether the input's value is invalid.

maxLength

number

The maximum number of characters allowed in the editable

name

string

The name attribute of the editable component. Used for form submission.

onEdit

() => void

The callback that is called when in the edit mode.

onFocusOutside

(event: FocusOutsideEvent) => void

Function called when the focus is moved outside the combobox

onInteractOutside

(event: InteractOutsideEvent) => void

Function called when an interaction happens outside the combobox

onPointerDownOutside

(event: PointerDownOutsideEvent) => void

Function called when the pointer is pressed down outside the combobox

onValueChange

(details: ValueChangeDetails) => void

The callback that is called when the editable's value is changed

onValueCommit

(details: ValueChangeDetails) => void

The callback that is called when the editable's value is submitted.

onValueRevert

(details: ValueChangeDetails) => void

The callback that is called when the esc key is pressed or the cancel button is clicked

placeholder

string | { edit: string; preview: string }

The placeholder value to show when the `value` is empty

readOnly

boolean

Whether the editable is readonly

selectOnFocus

boolean

Whether to select the text in the input when it is focused.

startWithEditView

boolean

Whether to start with the edit mode active.

submitMode

SubmitMode

The action that triggers submit in the edit mode: - "enter" - Trigger submit when the enter key is pressed - "blur" - Trigger submit when the editable is blurred - "none" - No action will trigger submit. You need to use the submit button - "both" - Pressing `Enter` and blurring the input will trigger submit

translations

IntlTranslations

Specifies the localized strings that identifies the accessibility elements and their states

value

string

The value of the editable in both edit and preview mode

EditableContext

areaProps

Dict<any>

cancel

() => void

Function to exit edit mode, and discard any changes

cancelTriggerProps

Dict<any>

clearValue

() => void

Function to clear the value of the editable

controlProps

Dict<any>

edit

() => void

Function to enter edit mode

editTriggerProps

Dict<any>

inputProps

Dict<any>

isEditing

boolean

Whether the editable is in edit mode

isValueEmpty

boolean

Whether the editable value is empty

labelProps

Dict<any>

previewProps

Dict<any>

rootProps

Dict<any>

setValue

(value: string) => void

Function to set the value of the editable

submit

() => void

Function to exit edit mode, and submit any changes

submitTriggerProps

Dict<any>

value

string

The current value of the editable