Skip to main content

Text Area

Use cases:

  • Comments
  • Descriptions
  • Multi-line text inputs
  • Complex searches

Examples​

Sample text area with maxlength 20 and three rows.Sample text area with resize both set

Declaration

<TextArea></TextArea>

Usage

import { TextArea } from '@genesislcap/rapid-design-system/react';

export function MyComponent() {
const handleTextAreaChanged = (event) => {
const target = event.target as HTMLInputElement;
console.log(target.value);
};
return (
<TextArea onChange={handleTextAreaChanged}></TextArea>
);
}

API​

Attributes:​

NameTypeDescriptionExample
appearance"filled" | "outline"Changes the general view of the element; this can be filled or outline
<text-area appearance="filled">
autofocusbooleanWhen true, the component will be focused when the page has finished loading
<text-area autofocus>
colsnumberDefines the size of the element horizontally. Default: 20
<text-area cols=2>
disabledbooleanSimilar to readonly, but with a blur on the component
<text-area disabled>
formIdstringAssociates this component to a form. Form id needs to be passed. If no Id informed, then it will be associated with the ancestor form
<text-area formId="formId">
maxlengthnumberThe maximum number of characters allowed
<text-area maxlength=100>
minlengthnumberThe minimum number of characters allowed
<text-area minlength=50>
namestringDefines the name of the element
<text-area name="textAreaName">
placeholderstringSets placeholder text for the element, which disappears when the user starts inputting
<text-area placeholder="Sample place holder text">
readonlybooleanIf true, the user cannot change the value of this field
<text-area readonly>
resize"none" | "both" | "vertical" | "horizontal"Configures which ways the user can resize the text area. Default: none
<text-area resize="vertical">
rowsnumberDefines the size of the element vertically. Default: 2
<text-area rows=5>
valuestringThe text area content. Use the sync utility to bind the data from the template back to the model.
<text-area value=${sync((x) => x.textAreaValue)}>

Properties​

This component doesn't have any properties which are not also controlled via attributes.

Slots​

SlotDescription
startContent before the text area input
endContent after the text area input

Parts​

PartDescription
labelThe label for the text area.
controlThe input for the text area
fieldThe text area element

Events fired​

EventTypeUseExample
changeeventEmits a custom change event when the text area content changes. Access the value on the event via .target.value.
<rapid-text-area @change="${(x) => x.myChangeHandler(event)}">

Events listened to​

This component doesn't listen to any events.

Further details​

This component is an implementation of an HTML text-area element.