How to use the @material/textfield/character-counter.MDCTextFieldCharacterCounter function in @material/textfield

To help you get started, we’ve selected a few @material/textfield examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github material-components / material-components-web-components / packages / textfield / src / mwc-textfield-base-element.ts View on Github external
protected async createFoundation() {
    if (this.lineRippleElement) {
      this.createLineRippleFoundation();
    }

    if (this.outlineElement) {
      this.createNotchedOutlineFoundation();
    }

    if (this.mdcFoundation !== undefined) {
      this.mdcFoundation.destroy();
    }
    this._characterCounter = this.charCounterElement ? new MDCTextFieldCharacterCounter(this.charCounterElement) : null;
    this.mdcFoundation = new this.mdcFoundationClass(this.createAdapter(), {
      characterCounter: this._characterCounter ? this._characterCounter.foundation : undefined
    });
    if (this.labelElement) {
      await this.labelElement.updateComplete;
    }
    this.mdcFoundation.init();
  }