A multi-line plain-text field for a large amount of free-form text, for example a comment in a review or feedback form.

Element
igc-textarea
Slots
default — The text content of the default slot sets the value of the component.
prefix — Renders content before the input.
suffix — Renders content after the input.
helper-text — Renders content below the input.
value-missing — Renders content when the required validation fails.
too-long — Renders content when the maxlength validation fails.
too-short — Renders content when the minlength validation fails.
custom-error — Renders content when a custom message is set with `setCustomValidity()`.
invalid — Renders content when the component is in invalid state (validity.valid = false).
CSS Parts
container — The main wrapper that holds all main input elements of the textarea.
input — The native textarea element.
label — The native label element of the textarea.
prefix — The prefix wrapper of the textarea.
suffix — The suffix wrapper of the textarea.
helper-text — The helper text wrapper of the textarea.
prefixed — Added to the container when an element that is not hidden is in the prefix slot.
suffixed — Added to the container when an element that is not hidden is in the suffix slot.
filled — Added to the container when the textarea has a value.
placeholder — Added to the container in the material theme when the textarea has a placeholder.
labelled — Added to the container in the material theme when the control has a label.
start — The wrapper of the prefix in the material theme.
notch — The wrapper of the label in the material theme.
filler — The outline segment between the notch and the end in the material theme.
end — The wrapper of the suffix in the material theme.

Whether and how the browser capitalizes the text that the user enters.

MDN documentation.

autocapitalize: string

Defined in src/components/textarea/textarea.ts:183

A hint for the browser on how to autofill the control. Refer to this page for additional information.

autocomplete: string

Defined in src/components/textarea/textarea.ts:173

Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap>(LitElement), HOST_COMBOBOX_ATTRIBUTES )

Whether the control is disabled. A disabled control is not validated, and the form does not submit its value.

disabled: boolean

Defined in src/internals/mixins/forms/types.ts:35

A hint to the browser for which virtual keyboard layout to display.

MDN documentation

inputMode: string

Defined in src/components/textarea/textarea.ts:193

Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap>(LitElement), HOST_COMBOBOX_ATTRIBUTES )

Whether the control shows the invalid state. It changes only the visual state, not the validity.

invalid: boolean

Defined in src/internals/mixins/forms/types.ts:43

The label for the control.

label: string

Defined in src/components/textarea/textarea.ts:201

Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap>(LitElement), HOST_COMBOBOX_ATTRIBUTES )

The name of the control, submitted with the form data.

name: string

Defined in src/internals/mixins/forms/types.ts:49

Whether the control has an outlined appearance.

outlined: boolean = false

Defined in src/components/textarea/textarea.ts:239

The placeholder text of the control.

placeholder: string

Defined in src/components/textarea/textarea.ts:247

Whether the control is read-only.

readOnly: boolean = false

Defined in src/components/textarea/textarea.ts:255

How the user can resize the control. With auto, the height of the control fits its content and the resize handle is hidden.

resize: TextareaResize = 'vertical'

Defined in src/components/textarea/textarea.ts:264

The number of visible text lines of the control. As in the native textarea, a value less than 1 shows 2 lines.

rows: number = 3

Defined in src/components/textarea/textarea.ts:273

Whether the browser checks the spelling of the value. As for the native attribute, only the "false" attribute value turns the check off.

spellcheck: boolean = true

Defined in src/components/textarea/textarea.ts:303

Whether the validation rules apply without restricting user input. The user can type past maxLength.

validateOnly: boolean = false

Defined in src/components/textarea/textarea.ts:322

How the control wraps long lines of text. With off, the lines do not wrap. Unlike the native element, hard does not add line breaks to the submitted value. Refer to this page on MDN for explanation of the available values.

wrap: "off" | "hard" | "soft" = 'soft'

Defined in src/components/textarea/textarea.ts:314

The tagName read-only property of the Element interface returns the tag name of the element on which it's called.

MDN Reference

tagName: "igc-textarea" = 'igc-textarea'

Defined in src/components/textarea/textarea.ts:112

Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap>(LitElement), HOST_COMBOBOX_ATTRIBUTES )

get defaultValue(): any

Defined in src/internals/mixins/forms/types.ts:158

The default value of the control. A form reset restores the value to it. While the value is unchanged since the start or the last form reset, a new default also sets the value. The value attribute also sets it.

set defaultValue(value: unknown): void

Defined in src/internals/mixins/forms/types.ts:158

Parameters

  • value: unknown

Returns void

Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap>(LitElement), HOST_COMBOBOX_ATTRIBUTES )

The form that the control is associated with, or null.

get form(): HTMLFormElement | null

Defined in src/internals/mixins/forms/types.ts:52

Returns HTMLFormElement | null

get maxLength(): any

Defined in src/components/textarea/textarea.ts:210

The maximum number of characters (UTF-16 code units) that the user can enter. If this value isn't specified, the user can enter an unlimited number of characters.

set maxLength(value: number): void

Defined in src/components/textarea/textarea.ts:210

Parameters

  • value: number

Returns void

get minLength(): any

Defined in src/components/textarea/textarea.ts:225

The minimum number of characters (UTF-16 code units) that the value must have.

set minLength(value: number): void

Defined in src/components/textarea/textarea.ts:225

Parameters

  • value: number

Returns void

Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap>(LitElement), HOST_COMBOBOX_ATTRIBUTES )

get required(): any

Defined in src/internals/mixins/forms/types.ts:188

Whether the control is required. A required control that has no value, or is not checked, fails validation.

set required(value: boolean): void

Defined in src/internals/mixins/forms/types.ts:188

Parameters

  • value: boolean

Returns void

The offset of the end of the text selection, in UTF-16 code units.

get selectionEnd(): number

Defined in src/components/textarea/textarea.ts:333

Returns number

The offset of the start of the text selection, in UTF-16 code units. Equals selectionEnd when no text is selected.

get selectionStart(): number

Defined in src/components/textarea/textarea.ts:328

Returns number

Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap>(LitElement), HOST_COMBOBOX_ATTRIBUTES )

The validation message of the control. It is empty when the control is valid.

get validationMessage(): string

Defined in src/internals/mixins/forms/types.ts:61

Returns string

Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap>(LitElement), HOST_COMBOBOX_ATTRIBUTES )

The validity state of the control.

get validity(): ValidityState

Defined in src/internals/mixins/forms/types.ts:55

Returns ValidityState

get value(): any

Defined in src/components/textarea/textarea.ts:282

The value of the component.

set value(value: string): void

Defined in src/components/textarea/textarea.ts:282

Parameters

  • value: string

Returns void

Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap>(LitElement), HOST_COMBOBOX_ATTRIBUTES )

Whether the control is a candidate for constraint validation.

get willValidate(): boolean

Defined in src/internals/mixins/forms/types.ts:64

Returns boolean

Removes focus from the control.

blur(): void

Defined in src/components/textarea/textarea.ts:446

Returns void

Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap>(LitElement), HOST_COMBOBOX_ATTRIBUTES )

Checks validity and emits invalid when the control is invalid. Returns true when the control is valid.

checkValidity(): boolean

Defined in src/internals/mixins/forms/types.ts:134

Returns boolean

Sets focus on the control.

focus(options: FocusOptions): void

Defined in src/components/textarea/textarea.ts:439

Parameters

  • options: FocusOptions

Returns void

Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap>(LitElement), HOST_COMBOBOX_ATTRIBUTES )

Checks validity. As for a native control, an invalid control emits invalid and takes the focus. It shows its own validation messages, not the message of the browser. Returns true when the control is valid.

reportValidity(): boolean

Defined in src/internals/mixins/forms/types.ts:141

Returns boolean

Scrolls the text of the control to the given position.

scrollTo(options: ScrollToOptions): void

Defined in src/components/textarea/textarea.ts:488

Parameters

  • options: ScrollToOptions

Returns void

Selects all text within the control.

select(): void

Defined in src/components/textarea/textarea.ts:452

Returns void

Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap>(LitElement), HOST_COMBOBOX_ATTRIBUTES )

Sets a custom validation message. The control is invalid while the message is not empty. An empty string removes the custom error.

setCustomValidity(message: string): void

Defined in src/internals/mixins/forms/types.ts:147

Parameters

  • message: string

Returns void

Replaces the text from start to end in the control. Without start and end, replaces the selected text.

setRangeText(replacement: string, start: number, end: number, selectMode: RangeTextSelectMode): void

Defined in src/components/textarea/textarea.ts:471

Parameters

  • replacement: string
  • start: number
  • end: number
  • selectMode: RangeTextSelectMode

Returns void

Sets the text selection range of the control.

setSelectionRange(start: number, end: number, direction: SelectionRangeDirection): void

Defined in src/components/textarea/textarea.ts:458

Parameters

  • start: number
  • end: number
  • direction: SelectionRangeDirection

Returns void