Text area

Several lines to type in, inside a panel. It starts three lines high and grows with the words.

Part of a Files window with a docked panel headed Note, holding a text area with three lines about the file, Signed copy sent to the landlord on 14 October. Deposit due before the first of November, with the keyboard ring, a forward Slab Save and a quiet Slab Cancel.
A note about a file, in a docked panel.

Use a text area where a person types a few lines: a note, a message, a description. It is the field's look with a message box's behaviour. For one line, use a field. For a value from a list, use a select.

Anatomy

Two text areas at 1.6 times their size in a panel: one with a line of text and the keyboard ring and caret, one empty with its hint. Numbered callouts name the box, the words, the hint, the caret and the ring.
A text area with text and one with its hint, at 1.6 times their size.
  1. BoxA rounded box, 12 pixels in the corner, a wash of the main ink at 6 % on the panel.
  2. WordsWhat was typed, in the main ink, 15 pixels, regular. They wrap at the width.
  3. HintShown while the box is empty, in the meta ink.
  4. Caret1.5 pixels wide, in the accent (in the risk ink while the box is in error).
  5. RingThe accent ring, 2 pixels, 2 pixels outside the box. It is always shown while the box has the keyboard: it is where typing goes.

States

The same text area in four columns: empty with its hint, under the pointer, with the keyboard and some words, and in error with words.
A text area empty, under the pointer, being typed in, and in error.
  1. Rest, emptyThe 6 % wash and the hint.
  2. Pointer over itThe wash steps up by 5 points, over 80 ms (see States). The pointer is an I-beam.
  3. TypingThe ring and the caret. The wash does not step up while it has the keyboard.
  4. ErrorThe ring, always shown, and the caret in the risk ink.

Unavailable (enabled: false) draws the words and the hint in the faint ink and takes no pointer, no key and no stop for Tab.

Growth

Three text areas side by side: one with a line of text and three lines of room, one grown to six lines, and one at eight lines holding more text than shows.
A text area at its least, grown, and at its most.

The box is minLines high (3 by default) and grows as the words need it, on the 250 ms arriveSmall motion, up to maxLines (8). Past that it scrolls, and keeps the caret in view. With reduced motion on, it changes height at once.

Sizes

A text area at one and a half times its size, 72 high at its least and 320 wide, with 12 pixels of room before the words.
A text area at 1.5 times its size.
PartValue
Height72 for three lines, 166 for eight: 8 above and below, and 18.75 a line
Width320 unless you set it
Padding12 each side, #8 above and below (space.m, space.s)
Corner12 (radius.slab)
Words15 pixels (row), regular; the hint in the meta ink
Wash6 % (wash.action); 11 % under the pointer
Caret1.5 pixels, accent
Ring2 pixels, 2 outside

Keys and pointer

A text area edits text as any multi-line input does. These keys are the part's own.

Do thisTo
EnterStart a new line
Ctrl + EnterSend what was typed (submitted). The app decides what that does
EscAsk to be dismissed (dismissed). The app closes the panel or gives the focus away
TabMove on to the next control. It does not type a tab
ClickPut the caret there; the ring shows

Accessibility

Writing

Put a visible label above the box, in a word or two: "Note". Use the hint for what to write, with an example: "Anything to remember about this file". It must not repeat the label. Tell people how to send if it is not obvious: Enter makes a new line, so a form that sends on Ctrl + Enter needs a button too.

Do and don't

A panel with the label Note above a text area holding Signed copy sent to the landlord.
DoPut a visible label above the box.
A panel with a text area holding Signed copy sent to the landlord and no label.
Don'tLeave out the label. Once someone types, the hint goes and nothing says what the box is for.
A panel with the label Note above an empty text area whose hint reads Anything to remember about this file.
DoUse the hint for what to write.
A panel with an empty text area whose hint reads Note, and no label.
Don'tUse the hint as the label. It repeats the name and says nothing about what to write.

Code

import Tacit.Kit

Column {
    spacing: 8
    TacitText { text: "Note"; ink: "sec" }
    TextArea {
        width: parent.width
        label: "Note"
        hint: "Anything to remember about this file"
        text: file.note
        onSubmitted: text => file.saveNote(text)
        onDismissed: panel.close()
    }
}
PropertyWhat it does
textWhat is typed
hintShown while empty
labelWhat a screen reader says. Set it
minLines, maxLinesThe least and the most lines high: 3 and 8. Past maxLines it scrolls
errorThe ring and caret in the risk ink
enabledFalse: the faint ink, no keyboard, no pointer
inputThe text input itself, for selection and keys
submitted(text)Ctrl + Enter was pressed
dismissed()Esc was pressed
edited()The text was changed
focusIn()Gives the box the keyboard

Experimental, in Tacit.Kit 0.1.