Skip to main content

Textarea

Textarea | Textarea element extended with new functions scoped

Textarea extends the capabilities of the standard HTML textarea element. It adds styles to achieve a visually consistent user interface and offers features such as auto-height - adjusting the height of an element to the inserted text, or also a counter for inserted characters.

Basic Usage

Standard

Adding the standard attribute will display a textarea in the style of the standard HTML textarea element.

Counter

Adding the counter attribute will display a counter below the textarea showing the number of characters inserted and the maximum number of characters allowed. It is to be used in combination with the max-length property. Otherwise, the maximum number allowed will be set to 1000.

Resize (none)

The resize property specifies the behavior of element resizing. If set to none, the field size remains fixed.

Resize (auto)

If the resize property is set to auto, the size of the element is automatically adjusted to the inserted content.

Disabled

When the disabled attribute is inserted into the textarea element, it will not be possible to write.

Attributes and Properties

counter

DescriptionIf true, adds a counter below the element showing the number of characters inserted and also the maximum number allowed.
Attributecounter
Typeboolean
Defaultfalse

disabled

DescriptionIf true, the textarea will not be writable.
Attributedisabled
Typeboolean
Defaultfalse

label

DescriptionDefines the text description for the textarea element.
Attributelabel
Typestring | undefined
Defaultundefined

maxlength

DescriptionSets the maximum number of characters allowed. Used in conjunction with the counter attribute.
Attributemaxlength
Typenumber | undefined
Default1000

name

DescriptionSets the name attribute of the inner textarea of the element. This is important, for example, when used in forms.
Attributename
Typestring
Defaultthis.inputId

resize

DescriptionDefines the behavior of element resizing. If it is set to "auto", the element size is automatically adjusted to the content.
Attributeresize
Type"car"
Defaultundefined

rows

DescriptionDefines the number of visible lines of text in the element.
Attributerows
Typenumber | undefined
Defaultundefined

spellcheck

DescriptionIf true, spell checking will be activated in textarea.
Attributespellcheck
Typeboolean
Defaultfalse

Option

DescriptionSetting it to "standard" will display a textarea in the style of the standard HTML textarea element.
AttributeOption
Typestring
Default''

Events

NameDescription
blurFired when an element loses focus.
wj:textarea:changeIt is invoked after a change in textarea.
focusCalled when the element gets focus.
wj:textarea:inputThe ionInput event is fired each time the user modifies the textarea's value. Unlike the ionChange event, the ionInput event is fired for each alteration to the textarea's value. This typically happens for each keystroke as the user types.

When clearOnEdit is enabled, the ionInput event will be fired when the user clears the textarea by performing a keydown event.

Methods

No public methods available for this component.

CSS Shadow Parts

NameDescription
inputRefers to the textarea element inside the element.

CSS Custom Properties

NameDescription
--wj-textarea-background-colorSets the background color of the element.
--wj-textarea-border-colorSets the color of the edges of the element.
--wj-textarea-border-color-focusSets the color of the edges when you take a photo.
--wj-textarea-border-radiusAdjusts the rounding of the element edges.
--wj-textarea-border-styleSets the element's border style.
--wj-textarea-border-widthSets the width of the element edges.
--wj-textarea-colorSets the text color of the element.
--wj-textarea-color-invalidSets the text color on error.
--wj-textarea-font-familySets the font of the element.
--wj-textarea-line-heightSets the height of the element row.
--wj-textarea-margin-bottomSets the lower outer offset of the element.
--wj-textarea-paddingSets the internal offset of the element.

Slots

No slots available for this component.