Text Area is a multiple line text input control.

Overview

Text Area allows users to enter a sizeable amount of free form text.

Sample

Usage

  • Collect user inputs like comments or reviews in forms

Accessibility

Keyboard navigation

KeyFunction
TabMoves focus to the next focusable element. If the currently focused element is the last element, focus will leave the component.
Tab and ShiftMoves focus to the previous focusable element. If the currently focused element is the first element, focus will leave the component.

API reference

Properties

PropertyAttributeDescriptionTypeDefault
columnscolumns

Specifies the component's number of columns.

number
disableddisabled

When true, interaction is prevented and the component is displayed with lower opacity.

booleanfalse
formform

Specifies the id of the component's associated form.

When not set, the component is associated with its ancestor form element, if one exists.

string
groupSeparatorgroup-separator

When true, number values are displayed with a group separator corresponding to the language and country format.

booleanfalse
labellabel

Specifies an accessible label for the component.

string
labelTextlabel-text

Specifies the component's label text.

string
limitTextlimit-text

When true, prevents input beyond the maxLength value, mimicking native text area behavior.

booleanfalse
loadingloading

When true, a busy indicator is displayed.

booleanfalse
maxLengthmax-length

When the component resides in a form, specifies the maximum number of characters allowed.

number
messageOverrides

Overrides individual strings used by the component.

Record<string, unknown> | undefined
minLengthmin-length

When the component resides in a form, specifies the minimum number of characters allowed.

number
namename

Specifies the name of the component. Required to pass the component's value on form submission.

string
numberingSystemnumbering-system

Specifies the Unicode numeral system used by the component for localization.

NumberingSystem
placeholderplaceholder

Specifies the placeholder text for the component.

string
readOnlyread-only

When true, the component's value can be read, but cannot be modified.

booleanfalse
requiredrequired

When true and the component resides in a form, the component must have a value in order for the form to submit.

booleanfalse
resizeresize

Specifies if the component is resizable.

"both" | "horizontal" | "vertical" | "none""both"
rowsrows

Specifies the component's number of rows.

number
scalescale

Specifies the size of the component.

"l" | "m" | "s""m"
statusstatus

Specifies the status of the input field, which determines message and icons.

Status"idle"
validationIconvalidation-icon

Specifies the validation icon to display under the component.

IconName | boolean
validationMessagevalidation-message

Specifies the validation message to display under the component.

string
validityread-only

The component's current validation state.

ValidityState
valuevalue

The component's value.

string""
wrapwrap

Specifies the wrapping mechanism for the text.

"soft" | "hard""soft"

Slots

NameDescription
default (unnamed)

A slot for adding text.

label-content

A slot for rendering content next to the component's labelText.

Styles

NameDescription
--calcite-text-area-background-color

Specifies the component's background color.

--calcite-text-area-border-color

Specifies the component's text area border color.

--calcite-text-area-character-limit-text-color

Specifies the color of the character limit text displayed in the footer of the component.

--calcite-text-area-divider-color

Specifies the color of the divider between the text area and footer.

--calcite-text-area-font-size

Specifies the font size of the text area and footer.

--calcite-text-area-max-height

Specifies the component's text area maximum height.

--calcite-text-area-min-height

Specifies the component's text area minimum height.

--calcite-text-area-max-width

Specifies the component's text area maximum width.

--calcite-text-area-min-width

Specifies the component's text area minimum width.

--calcite-text-area-text-color

Specifies the component's text color.

--calcite-text-area-corner-radius

Specifies component's corner radius.

--calcite-text-area-shadow

Specifies the component's shadow.

Events

NameDescriptionBehavior
calciteTextAreaChange

Fires each time a new value is typed and committed.

bubblescomposedcancelable
calciteTextAreaInput

Fires each time a new value is typed.

bubblescomposedcancelable

Methods

NameDescriptionSignature
componentOnReady

Creates a promise that resolves once the component is fully loaded.

componentOnReady(): Promise<this>
selectText

Selects the text of the component's value.

selectText(): Promise<void>
setFocus

Sets focus on the component.

setFocus(options?: FocusOptions): Promise<void>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.