Skip to main content

AutosizeController

Purpose

Auto-resize text-areas when the amount of content inside them changes. Attach it to a textarea that you want to autosize, and forget about it.

Note: Only works for user-initiated changes, if changes are made in JavaScript and input events are not emitted then the resize may not trigger.

Actions

ActionPurpose
--

Targets

TargetPurposeDefault
---

Classes

ClassPurposeDefault
---

Values

ValueTypeDescriptionDefault
----

Events

EventWhenDispatched onevent.detail
----

Side Effects

  • Adds event listeners to the attached element for focus, input.
  • Uses a ResizeObserver to observe the window.
  • Sets the style.height property on the element to the calculated height of the content.

How to Use