Represents a multi-line plain-text editing control, useful when you want to allow users to enter a sizeable amount of free-form text, for example a comment on a review or feedback form.
- Element
-
igc-textarea
- Slots
-
default— Text content from the default slot will be used as the value of the component. -
prefix— Renders content before the input. -
suffix— Renders content after 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 setCustomValidity(message) is set. -
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 input element of the textarea. -
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.
Properties
Section titled "Properties"autocapitalize
Section titled "autocapitalize"Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
autocapitalize: string Defined in src/components/textarea/textarea.ts:159
autocomplete
Section titled "autocomplete"Specifies what permission, if any, the browser has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field. Refer to this page for additional information.
autocomplete: string Defined in src/components/textarea/textarea.ts:149
disabled
Section titled "disabled"Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap, Constructor<LitElement>>( LitElement ) )
The disabled state of the component.
disabled: boolean Defined in src/internals/mixins/forms/types.ts:30
inputMode
Section titled "inputMode"Hints at the type of data that might be entered by the user while editing the element or its contents. This allows a browser to display an appropriate virtual keyboard.
inputMode: string Defined in src/components/textarea/textarea.ts:170
invalid
Section titled "invalid"Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap, Constructor<LitElement>>( LitElement ) )
Sets the control into invalid state (visual state only).
invalid: boolean Defined in src/internals/mixins/forms/types.ts:37
label
Section titled "label"The label for the control.
label: string Defined in src/components/textarea/textarea.ts:178
maxLength
Section titled "maxLength"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.
maxLength: number Defined in src/components/textarea/textarea.ts:187
minLength
Section titled "minLength"The minimum number of characters (UTF-16 code units) required that the user should enter.
minLength: number Defined in src/components/textarea/textarea.ts:195
Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap, Constructor<LitElement>>( LitElement ) )
The name of the control, submitted with the form data.
name: string Defined in src/internals/mixins/forms/types.ts:43
outlined
Section titled "outlined"Whether the control will have outlined appearance.
outlined: boolean = false Defined in src/components/textarea/textarea.ts:202
placeholder
Section titled "placeholder"The placeholder text of the control.
placeholder: string Defined in src/components/textarea/textarea.ts:210
readOnly
Section titled "readOnly"Makes the control a readonly field.
readOnly: boolean = false Defined in src/components/textarea/textarea.ts:218
resize
Section titled "resize"Controls whether the control can be resized.
When auto is set, the control will try to expand and fit its content.
resize: TextareaResize = 'vertical' Defined in src/components/textarea/textarea.ts:227
The number of visible text lines for the control. If it is specified, it must be a positive integer. If it is not specified, the default value is 3.
rows: number = 3 Defined in src/components/textarea/textarea.ts:236
spellcheck
Section titled "spellcheck"Controls whether the element may be checked for spelling errors.
spellcheck: boolean = true Defined in src/components/textarea/textarea.ts:265
validateOnly
Section titled "validateOnly"Enables validation rules to be evaluated without restricting user input. This applies to the maxLength property
when it is defined.
validateOnly: boolean = false Defined in src/components/textarea/textarea.ts:284
Indicates how the control should wrap the value for form submission. Refer to this page on MDN for explanation of the available values.
wrap: "off" | "hard" | "soft" = 'soft' Defined in src/components/textarea/textarea.ts:275
tagName
Section titled "tagName"The tagName read-only property of the Element interface returns the tag name of the element on which it's called.
tagName: "igc-textarea" = 'igc-textarea' Defined in src/components/textarea/textarea.ts:95
Accessors
Section titled "Accessors"defaultValue
Section titled "defaultValue"Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap, Constructor<LitElement>>( LitElement ) )
get defaultValue(): any Defined in src/internals/mixins/forms/types.ts:182
The initial value of the component.
set defaultValue(value: unknown): void Defined in src/internals/mixins/forms/types.ts:182
Parameters
- value:
unknown
Returns void
Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap, Constructor<LitElement>>( LitElement ) )
Returns the HTMLFormElement associated with this element.
get form(): HTMLFormElement | null Defined in src/internals/mixins/forms/types.ts:46
Returns HTMLFormElement | null
required
Section titled "required"Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap, Constructor<LitElement>>( LitElement ) )
get required(): any Defined in src/internals/mixins/forms/types.ts:207
When set, makes the component a required field for validation.
set required(value: boolean): void Defined in src/internals/mixins/forms/types.ts:207
Parameters
- value:
boolean
Returns void
validationMessage
Section titled "validationMessage"Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap, Constructor<LitElement>>( LitElement ) )
A string containing the validation message of this element.
get validationMessage(): string Defined in src/internals/mixins/forms/types.ts:55
Returns string
validity
Section titled "validity"Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap, Constructor<LitElement>>( LitElement ) )
Returns a ValidityState object which represents the different validity states the element can be in, with respect to constraint validation.
get validity(): ValidityState Defined in src/internals/mixins/forms/types.ts:52
Returns ValidityState
value
Section titled "value"get value(): any Defined in src/components/textarea/textarea.ts:245
The value of the component
set value(value: string): void Defined in src/components/textarea/textarea.ts:245
Parameters
- value:
string
Returns void
willValidate
Section titled "willValidate"Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap, Constructor<LitElement>>( LitElement ) )
A boolean value which returns true if the element is a submittable element that is a candidate for constraint validation.
get willValidate(): boolean Defined in src/internals/mixins/forms/types.ts:61
Returns boolean
Methods
Section titled "Methods"checkValidity
Section titled "checkValidity"Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap, Constructor<LitElement>>( LitElement ) )
Checks for validity of the control and emits the invalid event if it's invalid.
checkValidity(): boolean Defined in src/internals/mixins/forms/types.ts:166
Returns boolean
reportValidity
Section titled "reportValidity"Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap, Constructor<LitElement>>( LitElement ) )
Checks for validity of the control and shows the browser message if it's invalid.
reportValidity(): boolean Defined in src/internals/mixins/forms/types.ts:169
Returns boolean
scrollTo
Section titled "scrollTo"The scrollTo() method of the Element interface scrolls to a particular set of coordinates inside a given element.
scrollTo(options: ScrollToOptions): void Defined in src/components/textarea/textarea.ts:401
Parameters
- options:
ScrollToOptions
Returns void
select
Section titled "select"Selects all text within the control.
select(): void Defined in src/components/textarea/textarea.ts:374
Returns void
setCustomValidity
Section titled "setCustomValidity"Inherited from: FormAssociatedRequiredMixin( EventEmitterMixin<IgcTextareaComponentEventMap, Constructor<LitElement>>( LitElement ) )
Sets a custom validation message for the control.
As long as message is not empty, the control is considered invalid.
setCustomValidity(message: string): void Defined in src/internals/mixins/forms/types.ts:175
Parameters
- message:
string
Returns void
setRangeText
Section titled "setRangeText"Replaces the selected text in the control.
setRangeText(replacement: string, start: number, end: number, selectMode: RangeTextSelectMode): void Defined in src/components/textarea/textarea.ts:390
Parameters
- replacement:
string - start:
number - end:
number - selectMode:
RangeTextSelectMode
Returns void
setSelectionRange
Section titled "setSelectionRange"Sets the text selection range of the control
setSelectionRange(start: number, end: number, direction: SelectionRangeDirection): void Defined in src/components/textarea/textarea.ts:380
Parameters
- start:
number - end:
number - direction:
SelectionRangeDirection