Components
← All components

Character Counter

stimeo--character-counter

Shows the remaining/used character count and flags the over-limit state, announced politely.

The stimeo--character-counter controller watches a text field's length and writes the remaining or used count into an output element. It toggles the data-near-limit / data-over-limit state hooks and sets aria-invalid on the field once the limit is exceeded, and dispatches stimeo--character-counter:change with detail.length / detail.remaining / detail.over on every keystroke. The non-text state updates immediately, while the visible count — which lives in the aria-live="polite" region — is written on a short debounce so a screen reader is not flooded during fast typing (it hears the settled count when the user pauses). Behavior only — the count text is updated, not styled; the input listener and debounce timer are torn down on disconnect (Turbo included), and connect re-reads the field so the count survives a cache restore.

running