Forms

Editable text

@xui/editable-text

Inline click-to-edit text. Click (or focus + Enter) to edit; Enter or blur confirms, Escape reverts. multiline uses a textarea. Full ControlValueAccessor and [(value)] two-way binding.

Install

pnpm add @xui/editable-text

Add the barrel to a standalone component's imports:

import { XuiEditableTextImports } from '@xui/editable-text';

@Component({
  imports: [XuiEditableTextImports],
  // …
})

Examples

Default

Loading preview…

Placeholder

Loading preview…

Multiline

Loading preview…

Disabled

Loading preview…

API

XuiEditableText

componentxui-editable-text

Inline click-to-edit text: shows a label until clicked, then swaps to a field. Enter (or blur) confirms, Escape reverts. multiline uses a textarea; there Enter inserts a newline unless confirmOnEnterKey is set.

Variants

AxisOptionsDefaulteditingfalsetruefalse

Inputs

NameTypeDefaultclassClassValueExtra classes, merged into the component's own rather than replacing them.''valuetwo-waystringThe confirmed text. Two-way bindable with [(value)].''placeholderstringText shown while the value is empty, both in the editor and in its read-only form.''disabledbooleanBlock editing. The value still renders, but clicking it no longer opens the editor.falsemultilinebooleanEdit in a textarea rather than an input. Enter then inserts a newline unless confirmOnEnterKey is set.falseconfirmOnEnterKeybooleanIn multiline mode, whether Enter confirms rather than inserting a newline.falseselectAllOnFocusbooleanSelect the whole value when editing starts.truemaxLengthnumber | nullCap on the number of characters. null for no limit.null

Outputs

NameTypeconfirmedstringEmits the confirmed value.cancelledvoidEmits when editing is abandoned via Escape.editedvoidEmits when editing begins.changedstringEmits the draft on every keystroke while editing.

Source

libs/ui/editable-text/xui

xUI 2.0.0 — Apache 2.0 licensed. Built with Angular and Tailwind CSS.