Skip to content

Textarea

BetaFormsOpen in the workshop

Multi-line text: notes, ad markup, allow and block lists.

.xg-textarea inside .xg-field

Example and markup

Live, from xg-ui.css and xg-ui.js. Switch the brand and mode on the example itself, or for the whole site in the header.

Textarea

One domain per line. Up to 5,000.

Markup
<div class="xg-field" style="max-width:420px">
<label class="xg-label" for="blk">Blocked domains <span class="xg-opt">optional</span>
</label>
<textarea class="xg-textarea" id="blk" aria-describedby="blk-h">example-news.com
example-games.io</textarea>
<p class="xg-hint" id="blk-h" style="margin:0">One domain per line. Up to 5,000.</p>
</div>

States

Hover, focus and pressed are forced here with .is-hover, .is-focus and .is-active so they can be seen side by side; in a product they come from :hover, :focus-visible and :active.

Textarea: every state
StateTextarea
Default
Hover
Focus
Error
Disabled

When to use it

Use it for

text longer than one line, or one entry per line (domain lists, bundle IDs).

Not for

structured data that has its own control.

Rules

  • Say in the hint how entries are separated (“one domain per line”).
  • Resize vertically only.

Accessibility

  • Same as Input: label, hint and error linked by aria-describedby.

Every color pair this component uses is measured for both brands in light and dark on the Accessibility page.

Also in Forms: Input, Select, Checkbox, Radio, Switch, Segmented control, Search field, Date-range picker, Form layout.

Status Beta: usable; class names may still change in a minor release, with a note (see Releasing).