Skip to content

TextField: forward min/max/step for constrained numeric fields#154

Merged
th3-br41n merged 1 commit into
mainfrom
feat/text-field-numeric-bounds
Jul 13, 2026
Merged

TextField: forward min/max/step for constrained numeric fields#154
th3-br41n merged 1 commit into
mainfrom
feat/text-field-numeric-bounds

Conversation

@th3-br41n

Copy link
Copy Markdown
Contributor

Why

A type="number" field with bounds — e.g. Settings → Sync's "keep the last N days" (min=1 max=3650) — couldn't use the shared <TextField> face, because the primitive didn't forward min/max/step. So consumers dropped to a hand-rolled <input type="number"> just to get the bounds, and its height drifted from the <SelectMenu>/<Button> beside it. That's a root cause behind one of the shell control-face offenders.

What

Add optional min / max / step to TextFieldProps, forwarded to the underlying <input> (omitted entirely when unset, per the exactOptionalPropertyTypes spread pattern the primitive already uses). Additive and optional — zero change for every existing consumer.

Unblocks migrating the hand-rolled numeric fields onto the primitive (a follow-up that stacks on #152's control-face baseline so the ratchet shrinks as they move).

+2 tests (text-field.test.tsx): attributes forwarded when set, absent when unset.

Note: CI typecheck on this branch is red on a pre-existing main issue (presence-scenario.test.ts missing a PresenceRouter import) — fixed independently in #153; merge that first.

🤖 Generated with Claude Code

A `type="number"` field with bounds (e.g. Sync's "keep the last N days",
`min=1 max=3650`) couldn't use the shared `<TextField>` face because the
primitive didn't forward `min`/`max`/`step` — so consumers dropped to a
hand-rolled `<input type=number>` just to get bounds, and its height drifted
from the controls beside it. Forward the three (omitted when unset, per the
exactOptionalPropertyTypes spread pattern), so a constrained numeric field can
ride the primitive. +2 tests (forwarded when set / absent when unset).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@th3-br41n th3-br41n merged commit 2a3727b into main Jul 13, 2026
1 of 3 checks passed
@th3-br41n th3-br41n deleted the feat/text-field-numeric-bounds branch July 13, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant