Skip to content
Alpha

Hololink UI is under active development. Components, APIs and these docs may change without notice.

Holo Textarea

The <holo-textarea> component is a form-associated custom element for multi-line text input, following the same conventions as holo-text-field.

Use it for:

  • Entering several lines of free text: comments, descriptions, messages.
  • A field that submits with a form and shows validation errors.

Don’t use it for:

  • Short, single-line values. Use Text Field.
  • Rich text editing. Use a dedicated editor.
  • Choosing from a fixed list. Use Select.
<holo-textarea label="Comments" placeholder="Leave a comment..." rows="4"></holo-textarea>
<holo-textarea label="Comments" value="Locked content" disabled></holo-textarea>
<holo-textarea label="Comments" invalid error-message="Comments cannot be empty."></holo-textarea>

The component renders a native <textarea> and a <label> linked through for, so role, name and keyboard behaviour come from the browser. required, readonly, disabled and rows are applied to the native element. When invalid is set, it gets aria-invalid="true", and an errorMessage appears in a role="alert" element referenced by aria-describedby. The required marker is aria-hidden. The component is form-associated through ElementInternals (“This field is required.” when empty and required).

Key Action
Tab Moves focus to or from the field
Enter Inserts a new line
Typing and editing keys Native textarea behaviour
  • A visible focus ring (border colour and a 2px ring) is shown with :focus-visible.
  • The border uses border-control, so it meets 3:1 against the surface.
  • A placeholder is not a label.

You provide:

  • A label. Without one the textarea has no accessible name.
  • A helpful errorMessage that says how to fix the problem.
  • Any character-count or limit text, announced in a way users can perceive.

Importing

import '@philbob-sideprojects/hololink-ui/holo-textarea';

Properties

PropertyAttributeTypeDefaultDescription
disableddisabledbooleanfalseIf true, the field is disabled and non-interactive.
errorMessageerror-messagestring—Error message shown (and announced) when invalid is true.
invalidinvalidbooleanfalseMarks the field as invalid, applying invalid styling and ARIA attributes.
labellabelstring—The visible label text for the field.
namenamestring—The form field name submitted with the owning form.
placeholderplaceholderstring—Placeholder text shown when the field is empty.
readonlyreadonlybooleanfalseIf true, the field's value cannot be edited but is still submitted/focusable.
requiredrequiredbooleanfalseIf true, the field must have a value for the owning form to submit.
rowsrowsnumber4The number of visible text rows.
valuevaluestring''The current value of the field.

Events

EventDetailDescription
holoChangestringEmitted when the field is committed (blur/change) with the current value.
holoInputstringEmitted on every keystroke with the current value.

CSS custom properties

PropertyDescription
--holo-textarea-bgBackground color of the textarea.
--holo-textarea-border-colorBorder color of the textarea.
--holo-textarea-border-focusBorder color when focused.
--holo-textarea-border-hoverBorder color on hover.
--holo-textarea-colorText color of the textarea.
--holo-textarea-error-colorText color of the error message.
--holo-textarea-focus-ringFocus ring color.
--holo-textarea-invalid-borderBorder and focus ring color when invalid is true.
--holo-textarea-label-colorText color of the label.
--holo-textarea-label-gapSpace between the label and the textarea.
--holo-textarea-radiusCorner radius of the textarea.
--holo-textarea-required-colorColor of the required indicator.