Repository navigation
Common inline styles as utility classes - #624
Merged
Merged
Conversation
minWidth/minHeight 0 on Flex and Grid, align and wrap on Text, Heading, Flex and Grid, and the themed stroke caps on line icons were inline styles on nearly every page. They are foundations classes now (min-width-0, min-height-0, text-align-*, text-wrap-*, icon-stroke); values no class covers still go inline. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gNJtwQuhoLQdpygLCVEyk
…sses in the API surface snapshot Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gNJtwQuhoLQdpygLCVEyk
12 tasks done
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.
What
Lorant asked which inline styles core applies often enough to deserve a class (his examples:
min-width: 0pxon a Flex,text-wrap: nowrapon a Text).Audit
Rendered the whole core test suite (307 files) in jsdom and counted every inline declaration left on the DOM. Top results:
width/height: var(--static-space-40)width="40"), mostly DatePicker cells and NavIcon in testsstroke-linecap/linejoin: var(--icon-*, round)renderIcon.tsx)text-align: center/leftalignon Text, Heading, Flex, Gridmin-width: 0px/min-height: 0pxminWidth={0}on Flex/Grid (11 places in core alone, plus apps)text-wrap: balance/nowrapwrapon Text, Headingwhite-space: nowrap,user-select: none,flex-shrink: 0,isolation: isolatestyle={{…}}in Tooltip, Logo, Scrubber, SnapCarousel, Tag, SplitView, Media, CarouselThis PR (no behaviour change)
minWidth={0}/minHeight={0}(0,"0","0px") on Flex and Grid →min-width-0/min-height-0, the classesfillWidth/fillHeightalready use. No inline value.alignon Text, Heading, Flex, Grid →text-align-{left,center,right,justify,start,end};wrapon Text, Heading →text-wrap-{wrap,nowrap,balance,pretty,stable}. New in foundations (TEXT_ALIGNS,TEXT_WRAPSinutilities.spec.mjs, generated intotypography.generated.scss). Other values still go inline (textClasses()inlayoutClasses.ts)..icon-strokein foundationsutilities.scss(var(--icon-linecap, round),var(--icon-linejoin, round)). The svg keeps itsstroke-linecap="round"attributes as the fallback where foundations CSS isn't loaded (OG images). A caller'sstyleandclassNamestill apply.One cascade difference: an inline style beat everything, while these classes sit in the
once-uilayer, so an app's own unlayered CSS on the same element now wins over the prop. That matches how every other prop class behaves.Left for later
width="40") stay inline: classes for every token × width/height/min/max would add a lot of CSS for one var() each.user-select: none/white-space: nowrap/flex-shrink: 0styles sit next to other dynamic inline values in each component;.user-select-nonealready exists if we want to sweep them.Check
inline-style-classes.test.tsx(new), updated icon, blockquote and size-token tests; the full suite passes (4929 tests); lint gate at baseline;generate-utilities --checkclean.Generated by Claude Code