TextArea
Multiline editing preserves draft, selection and composition across unrelated updates.
Use the web element directly without the semantic runtime.
A registered presentation adapter can bind this component to host-owned meaning and state.
The standard recipe resolver does not select this component automatically.
Import and live example#
One labelled multi-line notes field with four visible rows.
Interactive preview requires JavaScript.
View the complete example source
import {registerAeliqoElements} from "@varendo/web";
import {
AeliqoCheckboxElement,
AeliqoComboboxElement,
AeliqoDateFieldElement,
AeliqoDateRangeElement,
AeliqoFieldGroupElement,
AeliqoFileInputElement,
AeliqoFormElement,
AeliqoNumberFieldElement,
AeliqoRadioGroupElement,
AeliqoSearchFieldElement,
AeliqoSelectElement,
AeliqoSliderElement,
AeliqoSwitchElement,
AeliqoTextAreaElement,
AeliqoTextFieldElement,
type AeliqoOption,
} from "@varendo/web/inputs";
const options: readonly AeliqoOption[] = [
{value: "ada", label: "Ada Lovelace", description: "Research"},
{value: "grace", label: "Grace Hopper", description: "Product"},
{value: "lin", label: "Lin Chen", disabled: true},
];
registerAeliqoElements();
const host = document.querySelector<HTMLElement>("#aeliqo-example") ?? (() => {
const created = document.createElement("div");
created.id = "aeliqo-example";
(document.body ?? document.documentElement).append(created);
return created;
})();
function createCatalogRoot(container: HTMLElement): HTMLElement {
const root = document.createElement("div");
root.dataset.catalogSourceRoot = "true";
root.style.display = "grid";
root.style.gap = "12px";
container.append(root);
return root;
}
function createCatalogElement<T extends HTMLElement>(tagName: string, container: HTMLElement): T {
const element = document.createElement(tagName) as T;
element.setAttribute("data-aeliqo-theme", "light");
container.append(element);
return element;
}
function appendSlottedText(root: HTMLElement, slot: string, textContent: string): void {
const content = document.createElement("span");
content.slot = slot;
content.textContent = textContent;
root.append(content);
}
const root = createCatalogRoot(host);
(((root) => {
const element = createCatalogElement<AeliqoTextAreaElement>("aeliqo-text-area", root);
element.label = "Notes";
element.name = "notes";
element.defaultValue = "Draft notes";
element.rows = 4;
element.spellcheck = true;
}))(root);
Purpose#
A labelled multi-line text area that keeps caret position and IME composition intact across updates.
The host can set value to supply or revise the draft; user edits update that local property and emit
typed change and commit events. The host owns application validation and persistence.
When to use it#
- You need more than one line of text, such as notes or a description.
- The field needs a label and a visible starting height.
- The host owns validation and persistence of the committed text.
When to use a different component#
Properties and defaults#
Set the current or initial draft and observe changes; multiline input stays intact during IME composition.
| Property | Use and ownership | Declared type | Initial value |
|---|---|---|---|
label | Provides the visible label and accessible name for the component. | string | '' |
description | Provides supporting text associated with the control or value. | string | '' |
error | Provides the current validation or operation error associated with the control. | string | '' |
required | Marks the control as required for validation and native accessibility semantics. | boolean | false |
disabled | Prevents user interaction while keeping the control and its current value visible. | boolean | false |
readOnly | Keeps the current value focusable and readable while preventing edits. | boolean | false |
name | Provides the stable form or action name used by the host to identify this control. | string | '' |
autocomplete | Passes an autocomplete purpose to the native input so browsers can offer an appropriate saved value. | string | 'off' |
locale | Selects locale-sensitive formatting and parsing behavior. | string | 'en-US' |
validationState | Controls the current idle, pending, valid, or invalid validation state. | AeliqoValidationState | 'idle' |
validator | Runs host-provided synchronous validation for a proposed input value. | AeliqoValidator<T> | undefined | undefined |
value | Controls the current value. Apply accepted user proposals back to this property. | string | '' |
defaultValue | Provides the initial uncontrolled value. Later updates come from component interaction. | string | '' |
inputType | Supplies input type to the component as application-owned input. | AeliqoTextFieldInputType | 'text' |
placeholder | Provides a short input hint when the current draft is empty; it does not replace a visible label. | string | '' |
maxLength | Sets the upper bound for max length. | inferred from initializer | -1 |
minLength | Sets the lower bound for min length. | inferred from initializer | -1 |
pattern | Provides the native validation pattern for text input. | string | '' |
inputMode | Supplies input mode to the component as application-owned input. | string | 'text' |
rows | Supplies the bounded records to render. The component never fetches or widens this set. | number | 4 |
spellcheck | Enables or disables browser spelling suggestions for text drafts. | boolean | true |
Events#
| Event | Payload | Emitted | Application responsibility |
|---|---|---|---|
aeliqo-input-change | {source, value, composing?} | Whenever the user proposes a draft value change. | Validate or store the draft and reassign controlled value or checked state. |
aeliqo-input-commit | {source, value} | After explicit commit, blur, or Enter where the control supports it. | Accept or reject the committed value and update authoritative form state. |
aeliqo-validation | {source, state, message} | When validation enters pending, valid, or invalid state. | Merge the result with application validation and display authoritative errors. |
Events cross the component boundary as user proposals. Validate their detail and current authority before applying a business effect.
Listen for aeliqo-input-change
const element = document.querySelector('aeliqo-text-area');<p>element?.addEventListener('aeliqo-input-change', (event) => {
const proposal = (event as CustomEvent<unknown>).detail;
// Validate the proposal, update host state, then assign controlled properties.
applyProposal(proposal);
});Listen for aeliqo-input-commit
const element = document.querySelector('aeliqo-text-area');</p>
<p>element?.addEventListener('aeliqo-input-commit', (event) => {
const proposal = (event as CustomEvent<unknown>).detail;
// Validate the proposal, update host state, then assign controlled properties.
applyProposal(proposal);
});Listen for aeliqo-validation
const element = document.querySelector('aeliqo-text-area');</p>
<p>element?.addEventListener('aeliqo-validation', (event) => {
const proposal = (event as CustomEvent<unknown>).detail;
// Validate the proposal, update host state, then assign controlled properties.
applyProposal(proposal);
});States and failure handling#
Relevant states:
- ready
- disabled
- read-only
- invalid
- pending
Expected result: The notes draft preserves line breaks and emits changes without submitting implicitly.
Keyboard, focus, and accessibility#
Keyboard behavior:
- Tab
- Arrow keys
- Enter creates a line
- IME composition
Exposed semantics:
- aria-describedby
- aria-invalid
- aria-readonly
- input
- role
- textarea
Responsive behavior#
Rows set the starting height. Keep the draft readable when the form narrows and preserve line breaks as it grows.
Style hooks#
- Shadow parts:
description,error,field,input,label,pending - Varendo design tokens referenced:
--aeliqo-color-muted
Performance limits#
- Public workload controls: `maxLength` (default -1).
Related components#
Generated TypeScript declaration#
View generated declaration
export declare class AeliqoTextAreaElement extends AeliqoTextControlElement {
protected readonly multiline = true;
}Version#
This page documents the Varendo 0.6 component contract.
