StartFoundationsComponentsContent

Textarea

A textarea takes text over several lines, such as a description, a message, or feedback. It is a bare box; wrap it in a Field to give it a label, help text, and errors.

Stable Figma
OverviewUsageAPIAccessibility
<tk-field label="Description" helper="A couple of sentences about what makes it special">
  <tk-textarea name="description" rows="4" limit="200"></tk-textarea>
</tk-field>

Anatomy

Part What it is
tk-textarea the element; one Tab stop
textarea part the native <textarea>, with its border and resize grip
counter the character count under the box, shown when limit is set

The label, help text, and error message come from a Field. There are no affixes and no size.

Height

<tk-textarea aria-label="Short note" rows="2"></tk-textarea>
<tk-textarea aria-label="Cover letter" rows="8"></tk-textarea>
  • rows sets the starting height (default 5). Match it to the expected answer: a two-sentence note doesn't need eight rows. The box is never shorter than 2 rows.
  • People can drag the corner to make it taller, never wider. The width follows your layout.
  • Longer text scrolls inside the box.

States

<tk-textarea aria-label="Shipping notes" readonly value="Leave at the front desk"></tk-textarea>
<tk-textarea aria-label="Internal notes" disabled value="Locked after review"></tk-textarea>
<tk-field label="Reason for return" required error="Enter a reason for the return">
  <tk-textarea name="reason" rows="3"></tk-textarea>
</tk-field>

The box works like an Input: no change on hover, and on focus its border takes the focus color and grows thicker inward.

  • readonly: people can focus, select, and copy the text, but not edit it.
  • disabled: the box can't be focused, edited, or resized, and it's left out of the form. Prefer readonly.
  • Error: set error on the Field. The border turns red and the message shows under the box.
  • Required: set required on the Field. Without a Field, set it on the textarea.

Enter adds a new line; it never submits the form. Submit with a button.

Character limit

<tk-field label="Bio">
  <tk-textarea name="bio" rows="3" limit="40" value="Product designer in Lisbon. Loves maps, trains, and good coffee."></tk-textarea>
</tk-field>
  • limit shows a counter under the box: "You can enter up to 200 characters", then "15 characters remaining", and over the limit, in red, "12 characters too many".
  • Typing and pasting are never blocked. People can paste a full answer and cut it down.
  • The red counter is the only signal. It doesn't mark the field invalid or stop the form from submitting. Check the length when the form is submitted, and set error on the Field if it's too long.
  • Add a limit only when there is a real one, such as a database or legal cap.
  • maxlength cuts off typing and pasting at the limit. Use limit for prose, and never set both.