Skip to content
Glint UI

Textarea

Several lines of text, growing with what is typed until it scrolls instead.

Usage

import { Textarea } from "@glint/components/textarea.slint";
export component AppWindow inherits Window {
in-out property <string> notes: "";
VerticalLayout {
alignment: center;
Textarea {
placeholder: "Add project notes…";
text <=> root.notes;
edited(updated) => {
// handle multiline edit
}
}
}
}

Textarea provides a multi-line text entry field that wraps words and automatically expands its preferred height as content grows.

Examples

Field-sizing content expansion

When placed inside a vertical layout without fixed height, Textarea begins at a comfortable minimum height and expands smoothly as additional lines are typed.

Read-only and disabled states

Set read-only: true to allow copying and scrolling while preventing text modification. Set enabled: false to dim the container and disable interaction.

Validation error state

Set invalid: true to render a destructive error border.

API Reference

Properties

PropertyTypeDefaultDescription
textin-out stringno defaultTwo-way bound to the contents.
placeholderin stringno defaultHint shown when empty.
enabledin booltrueWhen false, the textarea dims and stops accepting keystrokes.
read-onlyin boolfalseWhen true, the user can focus and select but not edit. Announced apart from enabled, like Input's: a log pane a user may still read and copy must not be published as a dead control.
invalidin boolfalseWhen true, paints the border in destructive state. The message that explains the error belongs to the surrounding Field.
has-focusout boolno defaultWhether the box currently holds keyboard focus — also whether the focus ring is drawn, which is what makes the ring assertable.
scroll-offsetout lengthno defaultHow far the text is scrolled under the box, as a non-positive offset. Zero until the content passes max-height, since up to there the box grows instead of scrolling.

Callbacks

CallbackDescription
edited(string)Fired on every keystroke with the current text.

Accessibility

  • Text input role. Publishes a single accessible-role: text-input node with the complete multi-line value.
  • Read-only vs Disabled. accessible-read-only and accessible-enabled are kept distinct so assistive technology does not announce read-only content as dead.
  • invalid announces the word “Invalid”. Slint 1.17 publishes no accessible-invalid, so the state rides the description channel ADR-0013 opened: the control’s own description first, then "Invalid" after it. A red border is not the announcement — this is.
  • Caret auto-reveal. Viewport automatically scrolls to keep the active typing caret in view.