TextField: forward min/max/step for constrained numeric fields#154
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 forwardmin/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/steptoTextFieldProps, forwarded to the underlying<input>(omitted entirely when unset, per theexactOptionalPropertyTypesspread 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.🤖 Generated with Claude Code