Textarea

A multi-line text field that can grow with its content. Form-associated.

Source on GitHub

A comment with a character count
0 / 280 CancelPost
    Autosize, rows and read-only
    Type a few lines here and watch it grow. 1.27.39 — faster startup, per-page modules, and the sidebar keeps its scroll.
    Variants, sizes and states
    Not editable, not submitted.
    Code

    API

    For AI agents: this API as Markdown, or every component in llms-full.txt.

    <ray-textarea> · RayTextarea

    Also forwards placeholder, autocomplete, minlength, maxlength, spellcheck and wrap. Initial value: the value attribute or the element's text.

    PropertyAttributeTypeDefaultDescription
    valuevaluestringCurrent value.
    rowsrowsnumber3Visible rows (minimum when autosize).
    autosizeautosizebooleanGrows with the content.
    maxRowsmax-rowsnumberWith autosize: stop growing and scroll after this many rows.
    namenamestringForm field name.
    labellabelstringVisible label.
    descriptiondescriptionstringHelp text.
    descriptionPositiondescription-position reflectsabove | belowaboveThe description before the control (help first) or after it, with the error (fields in a row stay aligned).
    errorerrorstringError text.
    requiredrequiredbooleanRequired for form submission.
    disableddisabledbooleanNot editable nor submitted.
    readonlyreadonlybooleanNot editable, still submitted.
    sizesize reflectsxs | sm | md | lg | xlsmFont size.
    variantvariant reflectsdefault | filled | unstyleddefaultBox style.
    highlight—functionMarks ranges of the text, painted behind it: called with the text on every change (typed or set), it returns { start, end, kind?, title? } offsets. kind "error" is red with a wavy underline; any other kind is styled with ::part(highlight-<kind>); title is the tooltip over the range. Ranges must not overlap.
    complete—functionInline suggestions: called as the user types (and on Ctrl+Space) with the text and the caret, it returns the part of the text a suggestion would replace and the suggestions ({ from, to, items }), or null for none. A list opens under that part (ArrowUp/Down, Enter or Tab to accept, Escape to close); the chosen item's value replaces from–to as an undoable edit, then ray-complete fires. The field becomes a combobox (aria-autocomplete, aria-expanded, aria-activedescendant).
    suggestionsLabelsuggestions-labelstringSuggestions (text textarea.suggestions)Accessible name of the suggestion list.
    AttributeDescription
    placeholderPlaceholder text.
    autocompleteForwarded to the inner textarea.
    minlengthMinimum length.
    maxlengthMaximum length.
    wrapsoft or hard.
    EventDescription
    ray-completeA suggestion was accepted (the text already has it).
    ray-highlight-hoverThe highlight range under the pointer changed: the range and the box of the line of it the pointer is on, or null on leaving a range. Anchor a ray-popover to rect (its anchor property) to show more than the title.
    inputOn every edit.
    changeWhen an edit is committed.
    PartDescription
    textareaThe inner <textarea>.
    wrapperThe box.
    suggestionsThe suggestion list (a listbox in the top layer).
    suggestionEach suggestion ([aria-selected] when active).
    suggestion-labelA suggestion's label (in the mono font).
    suggestion-detailA suggestion's detail.
    suggestion-descriptionA suggestion's description, under its label (in the interface font).
    highlightEach marked range (also highlight-<kind> for a range with a kind).
    text-layerThe layer behind the text that holds the marks.

    Texts

    What it writes itself, in English; setStrings() translates them (Getting started: Languages).

    KeyEnglish
    textarea.suggestionsSuggestions