AhaSlides Design
v0.52.0React · Vue · Lit

Patterns · Settings

Number with unit

A fixed-width digit input with the unit written IN FULL inline (rendered exactly as passed — "seconds", "points" — muted grey), a hover ▲/▼ stepper, a hard digit cap, clamp-on-change, and an error line — the settings field for a number that carries a unit.

Examples

Unit
Size
Hover a field to reveal the ▲/▼ stepper · the unit is inline, written IN FULL ("seconds")
Error line (probe) · sizes · disabled

API

PropTypeDefaultNotes
valuenumberControlled numeric value
unitstringInline suffix — written IN FULL, rendered exactly as passed (seconds, points, %)
minnumberLower clamp bound
maxnumberUpper clamp bound
stepnumber1Stepper / arrow-key increment
maxdigitsnumber4Hard digit cap — a keystroke past this many digits is ignored
sizesmall | default | largedefaultControl height — small 24 · default 32 · large 40; radius stays 8
errormessagestringPresence draws the red border/ring and the message line below
disabledbooleanfalseNon-interactive; grey fill
changeCustomEvent<{value}>Composed event on commit / stepper / arrow; read e.detail.value (clamped number)

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-number-with-unit';   // registers <aha-number-with-unit>

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

When to use

When to use
  • Number with unit — a number the host does NOT provide that carries a unit — a per-item timer, points-per-answer, a spin duration
  • Host time limit — a standard whole-slide countdown — use the host-native enableTimeLimit, not this
  • Select — the unit itself is changeable — a unit dropdown, not an inline suffix
A fixed unit is an inline suffix inside the field (SETTINGS-41) — a bordered box beside the input implies the unit is selectable. Write the unit IN FULL, rendered exactly as passed (`seconds`, `points`) — never truncated to a short label. Ship pre-filled with the recommended default and clamp immediately.
Surfaces
editor settings

Spec

Box height 32 (default) · radius 8 · digit input + inline unit + stepper · Sizes small 24 · default 32 · large 40 — all radius 8 · Unit 14/21 #8A8A8A inline suffix; written IN FULL, rendered exactly as passed (seconds, points) · Stepper ▲/▼ tertiary (system-caret-up/down), revealed on hover/focus; disabled at min/max · Digit cap maxDigits (default 4) — a keystroke past the cap is dropped; numeric only · Clamp value clamps to min/max on change AND blur (immediate fallback) · Error #F5222D border + ring + a 12/18 #F5222D message line below; sets aria-invalid · Focus #6A1EBB border + 2px #D3B4FF@30% ring (persistent wrapper) · Disabled #F1F1F1 fill, #EBEBEB border, not-allowed