Class IgcTextareaComponent

This element 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.

igc-textarea

  • 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).

igcInput - Emitted when the control receives user input.

igcChange - Emitted when the a change to the control value is committed by the user.

container - The main wrapper that holds all main input elements of the textarea.

input - The native input element of the igc-textarea.

label - The native label element of the igc-textarea.

prefix - The prefix wrapper of the igc-textarea.

suffix - The suffix wrapper of the igc-textarea.

helper-text - The helper text wrapper of the igc-textarea.

Hierarchy

Hierarchy

  • FormRequiredInterface<this> & FormAssociatedElementInterface<this> & EventEmitterInterface<
        IgcTextareaComponentEventMap,
        this,
    > & LitElement<this>
    • IgcTextareaComponent

Constructors

Properties

autocapitalize: string

Controls whether and how text input is automatically capitalized as it is entered/edited by the user.

MDN documentation.

autocomplete: string

Specifies what if any permission the browser has to provide for 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.

disabled: boolean

The disabled state of the component.

false
inputMode: string

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.

MDN documentation

inputmode

invalid: boolean

Sets the control into invalid state (visual state only).

false
label: string

The label for the control.

maxLength: number

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

minLength: number

The minimum number of characters (UTF-16 code units) required that the user should enter.

minlength

name: string

The name attribute of the control.

outlined: boolean = false

Whether the control will have outlined appearance.

placeholder: string

The placeholder attribute of the control.

readOnly: boolean = false

Makes the control a readonly field.

readonly

resize: TextareaResize = 'vertical'

Controls whether the control can be resized. When auto is set, the control will try to expand and fit its content.

rows: number = 3

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.

spellcheck: boolean = true

Controls whether the element may be checked for spelling errors.

validateOnly: boolean = false

Enables validation rules to be evaluated without restricting user input. This applies to the maxLength property when it is defined.

validate-only

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

Indicates how the control should wrap the value for form submission. Refer to this page on MDN for explanation of the available values.

styles: CSSResult[] = ...
tagName: "igc-textarea" = 'igc-textarea'

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

MDN Reference

Accessors

  • get defaultValue(): unknown

    Returns unknown

  • set defaultValue(value: unknown): void

    The initial value of the component.

    Parameters

    • value: unknown

    Returns void

  • get form(): HTMLFormElement | null

    Returns the HTMLFormElement associated with this element.

    Returns HTMLFormElement | null

  • get required(): boolean

    Returns boolean

  • set required(value: boolean): void

    When set, makes the component a required field for validation.

    false
    

    Parameters

    • value: boolean

    Returns void

  • get validationMessage(): string

    A string containing the validation message of this element.

    Returns string

  • get validity(): ValidityState

    Returns a ValidityState object which represents the different validity states the element can be in, with respect to constraint validation.

    Returns ValidityState

  • get willValidate(): boolean

    A boolean value which returns true if the element is a submittable element that is a candidate for constraint validation.

    Returns boolean

Methods

  • Type parameters

    Type Parameters

    Parameters

    • type: K
    • listener: (this: HTMLElement, ev: M[K]) => any
    • options: boolean | AddEventListenerOptions

    Returns void

  • Parameters

    • type: string
    • listener: EventListenerOrEventListenerObject
    • options: boolean | AddEventListenerOptions

    Returns void

  • Type parameters

    Type Parameters

    • K extends keyof HTMLElementEventMap

    Parameters

    • type: K
    • listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any
    • options: boolean | AddEventListenerOptions

    Returns void

  • Checks for validity of the control and emits the invalid event if it invalid.

    Returns boolean

  • Type parameters

    Type Parameters

    Parameters

    • type: K
    • listener: (this: HTMLElement, ev: M[K]) => any
    • options: boolean | EventListenerOptions

    Returns void

  • Parameters

    • type: string
    • listener: EventListenerOrEventListenerObject
    • options: boolean | EventListenerOptions

    Returns void

  • Type parameters

    Type Parameters

    • K extends keyof HTMLElementEventMap

    Parameters

    • type: K
    • listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any
    • options: boolean | EventListenerOptions

    Returns void

  • Checks for validity of the control and shows the browser message if it invalid.

    Returns boolean

  • The scrollTo() method of the Element interface scrolls to a particular set of coordinates inside a given element.

    MDN Reference

    Parameters

    • options: ScrollToOptions

    Returns void

  • Parameters

    • x: number
    • y: number

    Returns void

  • Sets a custom validation message for the control. As long as message is not empty, the control is considered invalid.

    Parameters

    • message: string

    Returns void