U.S. Web Design System: Character count component
Documents character count support for text inputs and textareas with labels, hints, maxlength, aria-describedby wiring, default no-JavaScript limit messages, use cases for brevity or legal limits, and avoidance guidance for backend-only limits, implied lengths, or highly unlikely limit failures.
What this source can teach
Use this source to compare a documented solution with the task and states in your own product.
- Start with the original. Open the source and find the guidance or example relevant to your task.
- Trace the connection. Use the claim notes below to see how this site applies the source to specific patterns.
- Check the setting. Compare the source's platform, people, and constraints with your own decision.
Pattern Decisions This Source Supports
| Pattern | Supported decision | Required contract | Claim note |
|---|---|---|---|
| Character count | Choose character count when the limit is real, useful to users, and enforceable in the same unit displayed by the interface. | The field accepts typing and paste normally; the counter observes length rather than blocking editing prematurely. | USWDS character count guidance supports real limits, associated count messages, fallback text, and avoidance of unnecessary counters. |
| Textarea | Choose textarea when the expected response is more than a short single-line answer. | Typing, selection, line breaks, paste, undo, redo, and spellcheck follow native textarea behavior. | USWDS character count guidance supports textarea limits with associated remaining-count messages. |
Comparisons supported by this source
- Character count vs textarea vs text input vs inline validation
USWDS documents character count use cases, maxlength, associated count messages, no-JavaScript fallback text, and avoidance guidance.
- Textarea vs text input vs inline validation vs error summary
USWDS documents textarea character-count markup and remaining-count association when limits are needed.
Evidence Role
This source is treated as pattern-library evidence. Its value comes from the specific claims and setting described above.
Publisher: U.S. Web Design System. Last checked: .