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 from DOM node on Xtend UI components with Xt.get.

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

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
Eventinit.xt.textareaautosizecontainerInit or reinit event
Eventstatus.xt.textareaautosizecontainerStatus event (enabled or disabled)
Eventdestroy.xt.textareaautosizecontainerDestroy event

Properties

Access properties by getting self object.

let self = Xt.get({ name: 'xt-textareaautosize', el: document.querySelector('.my-container') })
const container = self.container
SyntaxDescription
PropertycomponentName:StringComponent name (used in Xt.get)
Propertyoptions:ObjectFinal options
Propertyinitial:BooleanIf initial or reset activation
Propertydisabled:BooleanIf component disabled
Propertycontainer:NodeContainer node
Propertyform:NodeForm closest node

Methods

Call methods by getting self object.

let self = Xt.get({ name: 'xt-textareaautosize', el: document.querySelector('.my-container') })
self.destroy()
self = null
SyntaxDescription
Methodself.reinit()Reinit component
Methodself.disable()Disable component
Methodself.enable()Enable component
Methodself.destroy()Destroy component