Skip to content

feat: use caption-1 text for the small size of Button, MenuItem, Tabs and form fields - #656

Merged
blvdmitry merged 2 commits into
canaryfrom
claude/caption-1-small-components-hsriuk
Aug 15, 2026
Merged

feat: use caption-1 text for the small size of Button, MenuItem, Tabs and form fields#656
blvdmitry merged 2 commits into
canaryfrom
claude/caption-1-small-components-hsriuk

Conversation

@blvdmitry

@blvdmitry blvdmitry commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Button, MenuItem, Tabs, TextField, Select and PinField rendered body-2 text in their small size — the same variant as medium. They now render caption-1, matching Checkbox and Radio, which already do.

caption-1 has a smaller line height, so the components would have shrunk. Their vertical padding grows by half of the line height difference on each side, keeping the rendered size identical:

  • Each small size writes its vertical padding as calc(var(--rs-unit-x1) + (var(--rs-line-height-body-2) - var(--rs-line-height-caption-1)) / 2), deriving the compensation from the theme rather than hardcoding it. In the figma theme, where both line heights are already 1rem, it resolves to 0 and nothing changes.
  • Button min-width was written as line-height − x1 * 2 + p-h * 2, which only equalled min-height because horizontal padding happened to be exactly one unit larger than vertical padding at every size. That no longer holds for small, so both dimensions now read the same --rs-button-min-size value and icon-only buttons stay square.
  • Tabs and PinField size their items independently of the text, so they only switch the Text variant.

Also bumped PinField's small size off body-1, which was larger than the body-2 used by medium.

TextArea is not included — its size prop is medium | large | xlarge, so it has no small size to change.

Related Issue

N/A

Screenshots / Recordings

Measured in Chromium against the built CSS, comparing the branch to canary (slate theme, small rows are the ones that changed):

case before after
Button / small / text 28×50.27 (14px) 28×45.38 (12px)
Button / small / icon-only 28×28 (14px) 28×28 (12px)
Button / medium / text 36×58.27 (14px) 36×58.27 (14px)
Button / large / icon-only 48×48 (16px) 48×48 (16px)
Button / xlarge / text 56×84.05 (18px) 56×84.05 (18px)
MenuItem / small / text 28×46.27 (14px) 28×41.38 (12px)
MenuItem / small / icon 28×70.27 (14px) 28×65.38 (12px)
MenuItem / medium / text 36×58.27 (14px) 36×58.27 (14px)
Tabs / small / item 28×50.27 28×45.38
Tabs / small / item with icon 28×72.27 28×67.38
Tabs / medium / item 36×58.27 36×58.27
TextField / small 28×197 28×171
TextField / small / icon + affix 28×238.8 28×210.69
TextField / medium 36×205 36×205
TextField / xlarge 56×247 56×247
Select / small 28×73 28×68
Select / medium 36×83 36×83
Select / large 48×100 48×100

Heights are unchanged everywhere; only font size and intrinsic width shrink. The same comparison against the figma theme is byte-identical before and after, since its body-2 and caption-1 line heights match.

Notes for Reviewers

  • The compensation is derived from the line height tokens rather than written as a fixed x1-5 on purpose — hardcoding it would grow small components by 4px in any theme where the two line heights are already equal.
  • Worth a Chromatic run given this touches every small-size component.

… and form fields

Button, MenuItem, Tabs, TextField, Select and PinField rendered body-2 text
in their small size, matching the medium size. They now use caption-1,
following Checkbox and Radio which already do that.

caption-1 has a smaller line height, so the components would shrink. Their
vertical padding grows by half of the line height difference on each side to
keep the size unchanged. The difference is derived from the theme tokens via
--rs-caption-1-line-height-offset, so themes where both line heights match
resolve it to 0 and are unaffected.

Button min-width was expressed through the horizontal padding, which relied on
it being exactly one unit larger than the vertical one. It now reuses the same
value as min-height so icon-only buttons stay square.

PinField and Tabs size their items independently of the text, so they only
switch the Text variant.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UVFEsPkaDMhhb3CVc1zWkE
@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Library / JS 49.38 KB (+0.15% 🔺) 988 ms (+0.15% 🔺) 1.3 s (+35.93% 🔺) 2.2 s
Library / CSS 23.12 KB (+0.24% 🔺) 463 ms (+0.24% 🔺) 0 ms (+100% 🔺) 463 ms
Theming / JS 7.79 KB (0%) 156 ms (0%) 126 ms (+356.11% 🔺) 282 ms
Theming with a default theme definition / JS 8.67 KB (0%) 174 ms (0%) 87 ms (-52% 🔽) 261 ms

…nent

Replaces the --rs-caption-1-line-height-offset global variable with the same
calc written directly in each small size block, so no new theme-level variable
is introduced.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UVFEsPkaDMhhb3CVc1zWkE
@blvdmitry blvdmitry changed the title Use caption-1 text for the small size of Button, MenuItem, Tabs and form fields feat: use caption-1 text for the small size of Button, MenuItem, Tabs and form fields Aug 15, 2026
@blvdmitry
blvdmitry marked this pull request as ready for review August 15, 2026 22:57
@blvdmitry
blvdmitry merged commit 792c575 into canary Aug 15, 2026
22 of 23 checks passed
@blvdmitry
blvdmitry deleted the claude/caption-1-small-components-hsriuk branch August 15, 2026 22:58
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.

2 participants