AhaSlides Design
v0.52.0React · Vue · Lit

Patterns · Settings

Counted input

A single-line settings field whose character counter shows only while the field is focused and is hidden at rest — the shared CountedInput pattern for option/answer text.

Examples

Size
Max length
Status
Focus a field — the counter appears only while focused, hidden at rest
Sizes · small 24 · default 32 · large 40
States · no counter · disabled · readonly

API

PropTypeDefaultNotes
valuestring""Controlled text value
placeholderstringHint shown when empty
maxlengthnumber100Character cap (settings-lab default 100); drives the focus-only counter (shows current/max). Pass `none` to drop the cap and hide the counter
sizesmall | default | largedefaultControl height — small 24 · default 32 · large 40; radius stays 8
statusdefault | errordefaultError recolours the border + ring and sets aria-invalid
disabledbooleanfalseNon-interactive; grey fill
readonlybooleanfalseSelectable but not editable; secondary fill
inputCustomEvent<{value}>Composed event on each keystroke; read e.detail.value
changeCustomEvent<{value}>Composed event on commit (blur/enter)

Install

# .npmrc — once: point the @ahaslides-product scope at GitHub Packages
@ahaslides-product:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}   # a GitHub token with read:packages

npm i @ahaslides-product/design
import '@ahaslides-product/design/tokens.css';   // once, at the app root
import '@ahaslides-product/design/aha-counted-input';   // registers <aha-counted-input>

Agent feed for this component (absolute, fetchable anywhere): counted-input.agent.json · counted-input.md · counted-input.llms.txt

When to use

When to use
  • Counted input — a settings option/answer/label field that needs a character cap — the counter appears only on focus
  • Counted textarea — the same, but multi-line (descriptions, long answers)
  • Input — a general single-line field with no counter (names, search)
Never show a permanent counter on every field — it reads as heavy and steals width. The counter belongs inside the field, revealed on focus. Label the field with a noun phrase; use placeholder for an example, never as the label.
Surfaces
editor settings

Spec

Box height 32 (default) · radius 8 · padding 0 12 · Sizes small 24 · default 32 · large 40 — all radius 8 · Rest border 1px #E3E3E3 · Focus #6A1EBB border + 2px #D3B4FF@30% ring (on the persistent wrapper) · Counter 12/18 #8A8A8A, overlay inside the field, right 12; opacity 0 at rest → 1 on focus · Reveal focus-only (:host([_focused][_counted])) — hidden at rest; space always reserved (no shift) · Error #F5222D border + error-tinted ring; sets aria-invalid · Disabled #F1F1F1 fill, #EBEBEB border, not-allowed · Text Plus Jakarta 14/21; placeholder #8A8A8A