Character count
Character count helps users know how much text they can enter when there is a limit on the number of characters.
This component requires the following JavaScript plugins:
Example
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxComponent API
Root
-
x-character-countCustom Alpine directive that marks the Character Count Root.
Input / Textarea
-
x-character-count:inputCustom Alpine directive that marks the Character Count Input.
-
maxlengthType:
numberSets the limit on the number of characters allowed in the input. This attribute is validated natively by the browser.
-
aria-describedbyType:
stringAccessibility attribute that links various input descriptors to the input itself. This attribute accepts multiple values, seperated by a space.
Hint
A hint is made up of several (seemingly redundant) elements to account for progressive enhancement and assisted technology.
-
idType:
stringUnique value that links static hint element to the input via
aria-describedby. -
x-character-count:statusCustom Alpine directive that marks the Character Count Status.
-
aria-hidden="true"Type:
booleanAccessibility attribute that hides this element from screen readers.
-
x-character-count:sr-statusCustom Alpine directive that marks the Character Count Screen Reader Status.
-
aria-live="polite"Type:
stringAccessibility attribute that is used to notify screen readers of the current character count status when it is changed.