unscripted/ui

Textarea

A textarea that grows with its content. The autogrow JavaScript you've written five times is one CSS declaration now.

field-sizing

How it works

  • field-sizing-content (field-sizing: content) makes the textarea size itself to its value. No hidden mirror element, no scrollHeight measuring, no resize listener.
  • rows="3" sets the starting height, max-h-48 caps the growth — past that it scrolls.
  • Browsers without field-sizing simply keep the fixed rows height and scroll. Nothing to polyfill.

Browser support

Minimum stable version per engine, resolved at build time from MDN's browser-compat-data; Baseline status from the official web-features dataset. Everything degrades gracefully — the “when missing” column is the actual behavior, not a broken page.

FeatureChromeEdgeFirefoxSafariWhen missing
field-sizing: contentBaseline 2026 · newly available12312315226.2The textarea keeps its fixed rows height and scrolls.