Vivid API

Text Area

The Text Area component enables users to input longer, multi-line text when more extensive text entry is required.

Usage

All native attributes of the textarea are supported as well as some enhancements.

import { registerTextArea } from '@vonage/vivid-api';
registerTextArea('your-prefix');

Resize

Set the resize attribute to control how the text area can be resized by the user.

Slots

Helper Text Slot

The helper-text slot allows you to use rich content as the Text Area’s helper text.

Contextual-Help

The contextual-help slot allows you to add the Contextual Help component next to the label.

API Reference

Properties

PropertyTypeDefaultDescription
autofocusbooleanIndicates that this element should get focus after the page finishes loading.
charCountbooleanUse in combination with `maxlength` to display a character count.
colsnumberSizes the element horizontally by a number of character columns.
disabledbooleanSets the element's disabled state. A disabled element will not be included during form submission.
errorTextstringProvides a custom error message. Any current error state will be overridden.
formIdstringThe https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id | id of the https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form | form the element is associated to
helperTextstringProvides additional information to help the user enter the correct information. To add HTML to the helper text, use the helper-text slot instead.
initialValuestringThe default value of the element. This value sets the `value` property only when the `value` property has not been explicitly set.
labelstringThe label for the form element.
liststringAllows associating a https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist | datalist to the element by https://developer.mozilla.org/en-US/docs/Web/API/Element/id.
maxlengthnumberMaximum length (number of characters) of `value`
minlengthnumberThe minimum number of characters a user can enter.
namestringThe name of the element. This element's value will be surfaced during form submission under the provided name.
placeholderstringSets the placeholder value of the element, generally used to provide a hint to the user.
readOnlybooleanWhen true, the control will be immutable by user interaction. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly | readonly HTML attribute for more information.
requiredbooleanRequire the field to be completed prior to form submission.
resize'none' | 'both' | 'horizontal' | 'vertical'The resize mode of the element.
rowsnumberSizes the element vertically by a number of character rows.
spellcheckbooleanSets if the element is eligible for spell checking but the UA.
successTextstringProvides a custom success message. Any current error state will be overridden.
value
(modelValue)
stringThe current value of the element.
wrap'hard' | 'soft' | 'off'The wrap attribute
PropertyTypeDefaultDescription
autofocusbooleanIndicates that this element should get focus after the page finishes loading.
char-countbooleanUse in combination with `maxlength` to display a character count.
colsnumberSizes the element horizontally by a number of character columns.
disabledbooleanSets the element's disabled state. A disabled element will not be included during form submission.
error-textstringProvides a custom error message. Any current error state will be overridden.
formstringThe https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id | id of the https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form | form the element is associated to
helper-textstringProvides additional information to help the user enter the correct information. To add HTML to the helper text, use the helper-text slot instead.
valuestringThe default value of the element. This value sets the `value` property only when the `value` property has not been explicitly set.
labelstringThe label for the form element.
liststringAllows associating a https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist | datalist to the element by https://developer.mozilla.org/en-US/docs/Web/API/Element/id.
maxlengthnumberMaximum length (number of characters) of `value`
minlengthnumberThe minimum number of characters a user can enter.
namestringThe name of the element. This element's value will be surfaced during form submission under the provided name.
placeholderstringSets the placeholder value of the element, generally used to provide a hint to the user.
readonlybooleanWhen true, the control will be immutable by user interaction. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly | readonly HTML attribute for more information.
requiredbooleanRequire the field to be completed prior to form submission.
resize'none' | 'both' | 'horizontal' | 'vertical'The resize mode of the element.
rowsnumberSizes the element vertically by a number of character rows.
spellcheckbooleanSets if the element is eligible for spell checking but the UA.
success-textstringProvides a custom success message. Any current error state will be overridden.
current-valuestringThe current value of the element.
wrap'hard' | 'soft' | 'off'The wrap attribute

Slots

NameDescription
contextual-helpSlot for the contextual-help component, displayed next to the label.
helper-textDescribes how to use the text-area. Alternative to the `helper-text` attribute.
NameDescription
contextual-helpSlot for the contextual-help component, displayed next to the label.
helper-textDescribes how to use the text-area. Alternative to the `helper-text` attribute.

Events

NameTypeDescription
changeCustomEvent<undefined>Emits a custom 'change' event when the textarea emits a change event
inputEventFires when the value of the element changes.
NameTypeDescription
changeCustomEvent<undefined>Emits a custom 'change' event when the textarea emits a change event
inputEventFires when the value of the element changes.

Methods

NameParamsReturnsDescription
checkValiditybooleanReturn the current validity of the element.
reportValiditybooleanReturn the current validity of the element. If false, fires an invalid event at the element.
selectvoidSelects all the text in the text area
validatevoid{@inheritDoc (FormAssociated:interface).validate}