Skip to content

Autogrow textarea

Preview Available in release assets

Optionally grow a native textarea with its content while retaining a useful, resizable no-JavaScript control.

Autogrow textarea primary example

Show code
<div class="thin-field">
  <label for="bio">Biography</label>
  <textarea class="thin-textarea" id="bio" name="bio" data-enhance="autogrow" rows="3">
  </textarea>
</div>

Each authored example uses the production assets and includes copyable markup.

Anatomy

  • Native textarea
  • data-autogrow opt-in
  • Optional enhancement bundle

Variants and sizes

  • Authored rows — shown above
  • Theme-defined maximum block size — shown above

Rendered fixtures exercise authored content and constrained layouts with the same production assets.

  • Unenhanced — shown above
  • Enhanced — shown above
  • Content constrained by maximum height — shown above
  • Reset — shown above
  • Reconnected — shown above

Interaction and keyboard behavior

The enhancement responds to input and form reset. Once the authored maximum is reached, the textarea scrolls normally.

Accessibility

The behavior does not alter the control role, name, focus, value, validation, or keyboard behavior.

Contract
NATIVE
Basis
Native <textarea> with bounded enhancement; no APG widget
Evidence
  • tests/unit/behaviors/autogrow.test.ts

API

Add data-enhance=autogrow to <thin-textarea><textarea …></thin-textarea>, then call enhanceAutogrowTextareas(). Disconnect before replacing its root and reconnect or refresh afterward.

Behavior tier: dependency-free

Structured host, property, and example tables are not authored for this item yet. Use the summary above and the primary example.

Fallback

The authored textarea remains resizable, validated, scrollable, and submitted without the enhancement.

Assets and dependencies

  • /components.css
  • /behaviors.js

Dependencies: None

Source: packages/ui/src/items/autogrow/style.ts

Composition

Derived from the examples and style specs, not authored.

Composes