UI + UX Input And Data Entry standard

Character count

Expose the limit before entry, update count feedback at a useful pace, associate it with the field, preserve over-limit drafts, and give exact recovery guidance using the same character or word rule enforced by validation.

Decision first

Choose this pattern when the problem matches

Use when

  • A legal, editorial, messaging, moderation, or display constraint imposes a clear maximum length.
  • Users are likely to write or paste near the limit and need to revise before submit.
  • The product can preserve over-limit drafts and validate the same unit displayed in the counter.
  • A static fallback message can communicate the limit when script-driven count updates are unavailable.

Avoid when

  • The field has no meaningful maximum length.
  • The length limit is already obvious from the data type or format.
  • Almost no real users will approach the backend limit.
  • The limit exists only because storage or integration constraints should be fixed.
  • The implementation cannot count text the same way the server validates it.
  • Continuous count feedback would distract from a writing task without helping recovery.

Problem it prevents

Users need to write within a real text limit, but hidden limits, noisy counters, mismatched server rules, or silent truncation make it hard to know whether the draft will be accepted.

Pattern anatomy

What a strong implementation has to make clear

User need

A legal, editorial, messaging, database, moderation, or downstream-display rule imposes a maximum number of characters or words.

Pattern promise

Expose the limit before entry, update count feedback at a useful pace, associate it with the field, preserve over-limit drafts, and give exact recovery guidance using the same character or word rule enforced by validation.

Required state

Empty state with visible label, hint, and static maximum message.

Recovery path

The count is missing until after submit even though a hard maximum exists.

Access contract

Associate the count message with the field so users hear the limit and current status with the control.

Quality bar

The difference between expert and weak execution

Strong implementation

Specific, visible, recoverable

  • An appeal summary textarea says users can enter up to 120 characters, shows no urgent count while plenty of space remains, then changes to 18 characters remaining near the threshold.
  • A short biography field shows 9 words remaining because the editorial policy is word-based, not character-based.
  • A user pastes a long summary, sees that it is 23 characters over the limit, trims it in place, and submits without losing the original draft.
  • A user switches a grant abstract from character limit to word limit and the counter, hint, validation, and submitted status all change units together.
Weak implementation

Vague, hidden, hard to recover from

  • A long unrestricted comment box shows a decorative 5000-character counter that makes users think the answer should be shorter.
  • A hidden backend limit rejects a submitted explanation without showing any count, preserved draft, or exact amount over the limit.
  • A user composes a paragraph and the field silently truncates the last sentence at the maximum length.
  • A screen reader user hears a live region announce the remaining count after every character, interrupting the text they are typing.
UI guidance
  • Place count feedback next to the limited input or textarea, associate it with the field description, and show the maximum or remaining amount in the same unit the service validates.
  • Use threshold, warning, and error states that expose the limit without turning every keystroke into noisy feedback; preserve readable hint, count, and error text together.
UX guidance
  • Use character count only when a real character or word limit affects acceptance and users can adjust their answer before submission.
  • When users exceed the limit, preserve their full draft, state exactly how many characters or words must be removed, and provide an edit or trim path instead of silently cutting content.
Implementation contract

What the implementation must handle

States

  • Empty state with visible label, hint, and static maximum message.
  • Typing state before threshold where the limit remains available but does not create urgency.
  • Near-limit state showing remaining characters or words.
  • At-limit state explaining that no characters or words remain.

Interaction

  • The field accepts typing and paste normally; the counter observes length rather than blocking editing prematurely.
  • The count message uses the same character or word unit as validation and submitted payload checks.
  • Before the warning threshold, the interface keeps the maximum visible without repeatedly announcing remaining amounts.
  • When the remaining amount crosses the threshold, the count changes to a warning message near the field.

Accessibility

  • Associate the count message with the field so users hear the limit and current status with the control.
  • Keep the label and hint visible; do not make the counter the only instruction.
  • Avoid announcing every keystroke through a live region; delay or threshold announcements.
  • Use text and error styling that does not rely only on color for near-limit and over-limit states.

Review

  • Is there a real acceptance limit, and is it expressed in characters or words?
  • Would most users ever approach the limit, or is the counter just adding pressure?
  • Does server validation count the same text that the interface counts?
  • What happens when users paste text that is far over the limit?
Interactive lab

Inspect the states before you copy the pattern

Write within a real text limit

Move from calm maximum guidance to threshold warnings, switch character and word modes, exceed the limit, trim the draft, and submit a valid value.

Character count
Interactive demo is ready

Launch the live UI/UX lab when you want to inspect states, keyboard behavior, and common failure modes.

State To Inspect

Empty state with visible label, hint, and static maximum message.

Keyboard / Access

Typing, selection, paste, undo, redo, and line breaks follow the underlying input or textarea behavior.

Avoid Generating

Adding a counter to an unrestricted writing field because it looks informative.

Evidence trail

Source-backed claims behind this guidance

GOV.UK Design System: Character count

Government Digital Service - checked

GOV.UK character count guidance supports max characters, max words, thresholds, assistive messages, fallback text, and over-limit errors.

Material Design: Text fields

Google Material Design - checked

Material Design text-field guidance supports character or word counters when a limit exists.

Full agent/debug reference

Problem Context

  • A legal, editorial, messaging, database, moderation, or downstream-display rule imposes a maximum number of characters or words.
  • Users may paste text from another source and need to know whether the full draft fits before submitting.
  • The product can validate the same unit it displays and can preserve the draft even when it exceeds the limit.
  • Assistive technology users need the limit and count status without disruptive announcements on every keypress.
  • If many users hit the backend limit, the product may need a higher limit or redesigned storage rather than count pressure.

Selection Rules

  • Choose character count when the limit is real, useful to users, and enforceable in the same unit displayed by the interface.
  • Use word count when policy or review standards are expressed in words, not when the server actually enforces characters.
  • Use a textarea without count when users need paragraph entry but limits are absent, extremely high, or unlikely to affect real submissions.
  • Use text input without count when the expected value is short enough that length is already apparent from the field type or format.
  • Use inline validation for length errors that do not require continuous awareness while typing.
  • Escalate backend constraints when users regularly exceed a service-imposed limit; do not make the counter compensate for a bad limit.
  • Show a static maximum message when JavaScript is unavailable.
  • Do not silently truncate pasted or typed content; preserve the draft and explain the exact reduction needed.

Required States

  • Empty state with visible label, hint, and static maximum message.
  • Typing state before threshold where the limit remains available but does not create urgency.
  • Near-limit state showing remaining characters or words.
  • At-limit state explaining that no characters or words remain.
  • Over-limit state with error styling and exact amount over the limit.
  • Trimmed recovery state after the user edits or accepts a trim action.
  • Submitted valid state with accepted count and unit.
  • No-JavaScript fallback state with a visible maximum message.
  • Word-count mode when the actual constraint is word-based.
  • Assistive announcement state that avoids excessive live updates.

Interaction Contract

  • The field accepts typing and paste normally; the counter observes length rather than blocking editing prematurely.
  • The count message uses the same character or word unit as validation and submitted payload checks.
  • Before the warning threshold, the interface keeps the maximum visible without repeatedly announcing remaining amounts.
  • When the remaining amount crosses the threshold, the count changes to a warning message near the field.
  • When the user exceeds the limit, the field keeps the full draft and shows exactly how many characters or words must be removed.
  • A trim or edit action is explicit and reversible through normal undo instead of automatic truncation.
  • Errors, hints, and count messages are associated with the input or textarea through a shared description.

Implementation Checklist

  • Define the enforced unit, maximum, warning threshold, validation rule, fallback message, and server-side normalization before adding the counter.
  • Associate label, hint, count message, and error text with the field using stable ids and descriptions.
  • Use maxlength only when blocking additional input is acceptable; otherwise allow over-limit drafts and validate with a specific recovery message.
  • Implement pluralized messages for remaining, at-limit, and over-limit states in character and word modes.
  • Throttle or delay assistive announcements so users are not interrupted on every keystroke.
  • Keep count, error, and submitted payload checks aligned with server validation for Unicode, whitespace, pasted text, and line breaks.
  • Test no-JavaScript fallback, paste over limit, screen readers, mobile keyboards, zoom, translated strings, and server-returned length errors.

Common Generated-UI Mistakes

  • Adding a counter to an unrestricted writing field because it looks informative.
  • Using a character counter when the server counts bytes, normalized characters, words, or rich-text markup.
  • Hiding the limit until after submit.
  • Interrupting screen reader users with a live count after every keypress.
  • Silently truncating pasted text at the maximum length.
  • Using a low backend limit as a reason to pressure users instead of increasing the limit.
  • Showing remaining count in one place and a different maximum in validation.
  • Letting the counter replace specific required, too-short, or disallowed-content errors.

Critique Questions

  • Is there a real acceptance limit, and is it expressed in characters or words?
  • Would most users ever approach the limit, or is the counter just adding pressure?
  • Does server validation count the same text that the interface counts?
  • What happens when users paste text that is far over the limit?
  • Are count messages associated with the field without noisy announcements?
  • Should the service increase the backend limit instead of exposing it to users?
Accessibility
  • Associate the count message with the field so users hear the limit and current status with the control.
  • Keep the label and hint visible; do not make the counter the only instruction.
  • Avoid announcing every keystroke through a live region; delay or threshold announcements.
  • Use text and error styling that does not rely only on color for near-limit and over-limit states.
  • Preserve over-limit drafts so keyboard and assistive technology users can review and edit them.
  • Provide no-JavaScript fallback text that states the maximum before submission.
Keyboard Behavior
  • Typing, selection, paste, undo, redo, and line breaks follow the underlying input or textarea behavior.
  • Tab moves from the field to the next interactive control, not into the static count message.
  • If a trim action is provided, it is reachable after the field and has a specific accessible name.
  • Submit with over-limit text returns focus to the field or linked error without clearing the draft.
  • Switching between character and word modes updates the count without moving focus unexpectedly.
  • Undo after trimming should restore the previous draft when browser editing semantics allow it.
Variants
  • Character limit counter
  • Word limit counter
  • Textarea with remaining count
  • Text input with remaining count
  • Thresholded character count
  • Always-visible maximum message
  • Over-limit recovery counter
  • No-JavaScript maximum message

Verification

Last verified: