Skip to content

fix(number-input): prevent control overflow when Label is used - #10928

Open
waterWang wants to merge 1 commit into
chakra-ui:mainfrom
waterWang:fix/number-input-label-overflow
Open

fix(number-input): prevent control overflow when Label is used#10928
waterWang wants to merge 1 commit into
chakra-ui:mainfrom
waterWang:fix/number-input-label-overflow

Conversation

@waterWang

Copy link
Copy Markdown

Summary

Fixes the layout issue where NumberInput.Control overflows when NumberInput.Label is used inside NumberInput.Root.

Before

The NumberInput.Control was:

  • Positioned at top: "0" of the root
  • Spanned the full root height via height: "calc(100% - 2px)"

When a NumberInput.Label was added as a child of the root, the root's height increased to accommodate the label, causing the control to extend upward into the label area.

After

  • Removed the explicit top: "0" so the control uses its static position (right after the input in the normal flow)
  • Changed the control's height from calc(100% - 2px) to var(--input-height) — the control now matches the input height instead of the full root height
  • Added --input-height to the root slot in the size variants so the control can inherit this CSS variable

Verification

  • pnpm --filter=@chakra-ui/react typecheck passes
  • pnpm --filter=@chakra-ui/react test run passes
  • Added a number-input-with-label story that reproduces the original issue

Closes #10889

The NumberInput.Control was positioned at the top of the root and spanned
the full root height via `calc(100% - 2px)`. When a NumberInput.Label was
added inside the root, the control extended into the label area.

Fix: Remove explicit `top: "0"` so the control uses its static position
(after the input in the normal flow). Change height from `calc(100% - 2px)`
to `var(--input-height)` — the control now matches the input height instead
of the full root height. Add `--input-height` to the root slot in size
variants so the control can inherit this CSS variable.

Closes chakra-ui#10889
@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chakra-ui-storybook Ready Ready Preview Aug 11, 2026 9:35pm
chakra-v3-docs Ready Ready Preview Aug 11, 2026 9:35pm

Request Review

@changeset-bot

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ce00f46

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@chakra-ui/react Patch
@chakra-ui/charts Patch
@chakra-ui/cli Patch
@chakra-ui/codemod Patch
tanstack-router-ts Patch
@chakra-ui/panda-preset Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

Use of NumberInput.Label causing control to overflow

1 participant