An abstract custom HTMLElement designed for use with form inputs.

input An "input" event when the value of the input changes

change A "change" event when the value of the element changes

Type Parameters

  • FormInputValueType

Hierarchy (View Summary)

Properties

_internals: ElementInternals

Attached ElementInternals which provides form handling functionality.

_primaryInput: HTMLElement

The primary input (if any). Used to determine what element should receive focus when an associated label is clicked on.

The underlying value of the element.

formAssociated: boolean = true

Declare that this custom element provides form element functionality.

observedAttributes: string[] = ...

Attributes requiring change notifications

tagName: string

The HTML tag name used by this element.

Accessors

  • get abortSignal(): AbortSignal

    An AbortSignal that can be passed to event listeners registered in subclasses. The signal will ensure that the listener is removed when the element is disconnected from the DOM. Not available in the constructor.

    Returns AbortSignal

  • get disabled(): boolean

    Is this element disabled?

    Returns boolean

  • get editable(): boolean

    Is this field editable? The field can be neither disabled nor readonly.

    Returns boolean

  • get form(): HTMLFormElement

    The form this element belongs to.

    Returns HTMLFormElement

  • get name(): string

    The input element name.

    Returns string

Methods

  • Internal

    Apply key attributes on the containing custom HTML element to input elements contained within it.

    Parameters

    • input: HTMLElement

    Returns void

  • Parameters

    • attrName: any
    • oldValue: any
    • newValue: any

    Returns void

  • Initialize the custom element, constructing its HTML.

    Returns void

  • Returns void

  • Parameters

    • disabled: any

    Returns void

  • Protected

    Activate event listeners which add dynamic behavior to the custom element.

    Returns void

  • Protected

    Create the HTML elements that should be included in this custom element. Elements are returned as an array of ordered children.

    Returns HTMLElement[]

  • Protected

    A method provided for subclasses to perform tear-down workflows as an alternative to overriding disconnectedCallback.

    Returns void

  • Protected

    Special handling when the custom element is clicked. This should be implemented to transfer focus to an appropriate internal element.

    Parameters

    • event: PointerEvent

    Returns void

  • Protected

    Refresh the active state of the custom element.

    Returns void

  • Protected

    Translate user-provided input value into the format that should be stored.

    Parameters

    Returns void

    An error if the provided value is invalid

  • Protected

    Special behaviors that the subclass should implement when toggling the disabled state of the input.

    Parameters

    • disabled: boolean

      The new disabled state

    Returns void