Skip to content

Textarea

<tpg-text-area></tpg-text-area>

Basic usage

Text Areas are multi-line fields of text.

Text areas do not allow for scrolling inside them. Instead, they can assume one of the following behavior:

  • Default: Text areas scale with the text being written, limitlessly

  • Character count: Text areas scale until a predefined character count is reached (Not yet implemented.)

  • Unfocused line limit: Text areas scale limitlessly, but, when out of Focused, the Text Area will collapse back to show a predefined number of lines. The full text will be shown again if / when the Text Area is Focused (Not yet implemented.)

A large initial size can be set to indicate that longer responses are possible and encouraged.

Examples

Textarea types

Use the type attribute to set the textarea’s type.

Icon

Use the icon-template attribute to set icons.

Message

Alert users with the message attribute. The type attribute changes the styling of the badge rendered when message is included.

Counter

Use the counter attribute to add a counter.

Note: we do not prevent the user from inputting more text should number of characters exceed the counter limit.

Rows

Use the rows attribute to set the initial height of the textarea.

States

The Text Area is enabled by default, but it can be set to disabled or read-only using the corresponding attributes.

Handling events

Tables

Properties

Attribute Property Description Type Default Value
value value The value of the text area string ''
placeholder placeholder Placeholder to be displayed in the text area. string ''
label label Label to be displayed in the text area. string ''
counter counter Whether or not to display a word counter. number 0
type type What type of text area to render. 'default' | 'error' | 'warning' | 'danger' 'default'
message message Whether or not to render a message in reference to the type. string ''
icon-template iconTemplate URI-encoded svg of optional icon to render on the trailing end of the count component IconConstant | '' ''
disabled disabled Whether or not the text area is diabled. boolean false
read-only readOnly Flag that makes the textarea read-only. boolean false
rows rows The number of rows to display by default. number 4
form-associated formAssociated boolean true
name name name property for use in conjunction with html forms string

Events

Event name Reactjs attribute Description
tpg-input ontpg-input Event emitted when text-area receives input while not disabled or readonly. Contains the new input value.
tpg-focus ontpg-focus Event emitted When the text-field loses focus
tpg-blur ontpg-blur Event emitted when the text-area loses focus

Functions

Name Description Arguments
No functions found.

Slots

Name Description
No slots found.

CSS Parts

Attribute Description
No CSS parts found.

Sandbox