Textareaautosize
Form

Textareaautosize is a plugin that manages automatic size on textarea.

Javascript

Import the javascript file with import 'xtendui/src/textareaautosize'.

Initialize automatically within markup with [data-xt-textareaautosize="{ <options> }"].

Initialize manually within javascript with new Xt.Textareaautosize(document.querySelector('.my-container'), {/* options */}).

Usage

You can customize min-height and max-height of the textarea.

Util

You can get self object on Xtend UI components with the constructor or Xt.get.

new Xt.Textareaautosize(document.querySelector('.my-container'), {}).then(self => {})

// or

Xt.get({ name: 'xt-textareaautosize', el: document.querySelector('.my-container') }).then(self => {})

By default components are loaded and initialized only when inside viewport or instantly if self.container is not visible (display: none).

You can force global observer options or singular component observer options passing this option.

SyntaxDefault / ArgumentsDescription
Optionobserver:Boolean|nullnullForce enable or disable intersection observer

Match Media

You can add additional options that gets added on match media query. You can use different queries with different and nested options.

SyntaxDefault / ArgumentsDescription
Optionmatches:ObjectfalseAdd additional options on match media query

Listen

Listen to events, for listeners use this guideline.

SyntaxDOM ElementDescription
Eventsetup.xt.textareaautosizecontainerSetup event
Eventinit.xt.textareaautosizecontainerInit or reinit event
Eventstatus.xt.textareaautosizecontainerStatus event (enabled or disabled)
Eventdestroy.xt.textareaautosizecontainerDestroy event

Properties

Access properties by getting self object.

SyntaxDescription
Propertyself.componentName:StringComponent name (used in Xt.get)
Propertyself.options:ObjectFinal options
Propertyself.initial:BooleanIf initial or reset activation
Propertyself.disabled:BooleanIf component disabled
Propertyself.container:NodeContainer node
Propertyself.form:NodeForm closest node

Methods

Call methods by getting self object.

SyntaxDescription
Methodself.reinit()Reinit component
Methodself.disable()Disable component
Methodself.enable()Enable component
Methodself.destroy()Destroy component