# Textarea

Several lines of text, such as a note to the hiring manager.

This is the HTML to build it with `dex.css`, for work outside the Dex codebase. Read https://brand.meetdex.ai/design.md first: it says how to set up a page and how to use the stylesheet. The page at https://brand.meetdex.ai/components/textarea shows the Dex app's own React component, which only works inside the Dex codebase.

## HTML

A `<textarea class="dex-field">`. It starts 96px tall.

```html
<div class="dex-form-row">
  <label class="dex-field-label" for="note">Note to the hiring manager <span class="dex-muted">(optional)</span></label>
  <textarea class="dex-field" id="note" placeholder="What drew you to the role at Synthesia?"></textarea>
</div>
```

- **Grows with its content**: `dex.css` makes it resizable by hand, not self-sizing. To have it grow and then scroll, add layout CSS of your own: `style="field-sizing: content; max-height: min(20rem, 40vh)"`.
- **With a character count**: only when there's a limit. Set `maxlength` and put the count at the end of the helper row:

```html
<div class="dex-form-row">
  <label class="dex-field-label" for="pitch">Why this role</label>
  <textarea class="dex-field" id="pitch" maxlength="500" aria-describedby="pitch-help"></textarea>
  <div style="display: flex; justify-content: space-between; gap: 1rem">
    <span class="dex-field-help" id="pitch-help">A few sentences is plenty.</span>
    <span class="dex-field-help" style="font-variant-numeric: tabular-nums">0 / 500</span>
  </div>
</div>
```

- **Invalid**: `aria-invalid="true"` and a `dex-field-error` in the helper text's place.
- **Disabled** and **read-only**: the `disabled` and `readonly` attributes, as on an input. Give a read-only textarea helper text saying where it came from.

## Rules

- Use a textarea for anything longer than a sentence. For one line, use an input.
- Cap its height so a long entry can't push a dialog's buttons off the screen.
- Show a count only when there's a limit.
- The text is 16px at every size, so phones don't zoom in.
