You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NOTE: Place this inside .mdc-text-field-helper-line for single line mdc text field which is an immediate sibling of .mdc-text-field and
place it as first element of .mdc-text-field for multi-line text field variant (textarea).
Positions the character counter element inside text field. Used only for textarea variant.
MDCTextFieldCharacterCounter properties and methods
Property
Value Type
Description
foundation
MDCTextFieldCharacterCounterFoundation
Returns the character counter's foundation. This allows the parent MDCTextField component to access the public methods on the MDCTextFieldCharacterCounterFoundation class.
Usage within frameworks
If you are using a JavaScript framework, such as React or Angular, you can create a Character Counter for your framework. Depending on your needs, you can use the Simple Approach: Wrapping MDC Web Vanilla Components, or the Advanced Approach: Using Foundations and Adapters. Please follow the instructions here.
MDCTextFieldCharacterCounterAdapter
Method Signature
Description
setContent(content: string) => void
Sets the text content of character counter element.