Skip to content

feat(Icon): a theme's width and height on an Icon size set its glyph dimension - #8759

Merged
imdreamrunner merged 5 commits into
mainfrom
icons/ast087-size-dimensions
Oct 28, 2026
Merged

imdreamrunner merged 5 commits into
mainfrom
icons/ast087-size-dimensions

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

User need

A theme author who wants a product's icons at a different scale — a dense theme with smaller sm icons, or a brand whose artwork reads better slightly larger — has no working way to change what an Icon size measures. Writing width and height on the icon target only resizes the box around a semantic icon: its 1em artwork keeps the old size inside it. In an app that compiles StyleX without CSS layers, the theme rule loses to Icon's own size styles and nothing changes at all. Authors fall back to patching the Icon component, wrapping it, or passing pixel sizes at every callsite, so the product's icon scale drifts per callsite instead of being one theme decision.

Problem and solution fit

  • Primary: Icon's size styles read the icon target's dimension. The derived-var registry carries width and height written on the icon target as two private vars, and both glyph modes size from them, falling back to each size's rem value. A semantic icon's box also takes the smaller side as its font size, so the 1em artwork that the built-in icons and the shipped themes supply follows the dimension.
  • Supporting: the registry entry and its Icon.doc.mjs theming.vars / theming.derived metadata, consumer docs for the size prop and an Icon sizes section in astryx docs theme, the size theming story's guidance (it no longer tells authors to add fontSize), focused tests at the runtime and built-theme layers, and a changeset.

Current specification

  • spec:AST-087 FR10 and DEC-3: the Icon theming target guarantees width and height on its size selectors; without theme styles, sizes are 12, 16, 20, and 24px at a 16px root and scale with the root font size.
  • component:Icon FR7 (the guarantee as a reviewed target-specific addition), FR3 (width, height, and font size for 1em sources), ORD2.
  • architecture:component-theming-surface INV7, INV8, and INV11 (exact declared properties; private expansion stays private). architecture:theme-compilation INV2–INV5 (one compiler for runtime and built themes; a guaranteed property may route through a checked registry entry to stay observable).

Public delta and caller burden

Theme code is unchanged; what it does changes:

const brandTheme = defineTheme({
  name: 'brand',
  components: {
    icon: {
      'size:sm': {width: '1.125rem', height: '1.125rem'},
      'size:lg': {width: '1.75rem', height: '1.75rem'},
    },
  },
});
  • Before: semantic icons got an 18px box around 16px artwork; SVG components passed to Icon resized only when StyleX was layered; in an unlayered StyleX app neither changed.
  • After: sm and lg glyphs render at the theme's dimension for semantic icon names (built-in and theme-supplied artwork) and for SVG components, in runtime and built themes, layered or not.

Compatibility:

  • Sizes a theme does not style render as before: 12, 16, 20, and 24px at a 16px root, scaling with the root font size.
  • No new props, types, exports, or size names. The theme compiler now writes width/height on the icon target as Icon's private size vars rather than as raw properties, the way it already does for progress-bar-mark.
  • A non-square dimension fits a semantic icon's square 1em artwork to the smaller side, as an SVG viewBox already does for an SVG component.
  • Dimensions are given in px or rem, as the docs say. A semantic icon takes its font size from the dimension, so an em dimension also scales its own box: size:md at 1.25em in 16px text renders 20px artwork (as an SVG component does) inside a 25px box. Avoiding that would need a second element around the artwork.
  • The size theming story drops the fontSize it told theme authors to add: width and height now size both glyph modes, and a raw fontSize beside a non-square dimension would make the glyph depend on StyleX layering again.
  • An instance xstyle width or height on an Icon wins over the theme's dimension in every cascade (ORD2); before, the result depended on whether StyleX was layered.
  • Component-owned icon boxes, such as Button's icon wrapper, keep their own size. Making them follow the theme dimension is outside AST-087 (its Non-goals) and is not part of this change.

Caller decisions added: none for product code. Theme authors who want sizes to keep scaling with the root font size use rem, as the docs say.

Design and alternatives

  • Chosen: route the two properties through checked registry entries (replaces: true) to private vars that only Icon's size styles read, with each size's value as the fallback. This is the existing progress-bar-mark mechanism. It lands whatever the consumer's StyleX layering is, and runtime and built themes share it because both call the same compiler.
  • Rejected: keep raw width/height and add a font size. Raw properties still lose to unlayered StyleX, and a font size cannot follow a width declared by another rule.
  • Rejected: an inner wrapper or container-query units to size the artwork. Both add DOM that architecture:component-style-authoring INV5 and INV7 do not admit.
  • Rejected: a public --icon-size custom property. architecture:component-theming-surface INV10 admits a public var only when no guaranteed property expresses the need; width and height do.
  • Rejected by the spec: theme-added size names (DEC-3).

Evidence

Automated:

  • Icon.test.tsx: for each of the four sizes, a runtime theme that styles only that size mounts a rule that writes the dimension (18×22) into exactly the vars that size's glyph reads, in both source modes, with no raw width/height; a semantic icon's font size reads both vars; the other three sizes get no rule and keep their own rem value. Unthemed sizes resolve to 0.75, 1, 1.25, and 1.5rem in both modes. Fails if the registry entry is removed, if a size stops reading a var, or if the registry font size stops following.
  • IconButton.test.tsx: the contextual-size suite reads the Icon's unthemed value through the same fallback; the wrapper is unchanged.
  • derivedVarRegistry.test.ts: the registry entry, its doc mirror, and that a component reads each var.
  • build.test.mjs: astryx theme build writes the icon size dimension as the same vars, with no warnings.

Real browser (Chromium 149, headless). I rendered the same matrix on this branch and on main: each Icon size × a built-in semantic icon, a theme-supplied 1em semantic icon, and an SVG component with width="24" height="24" attributes. Pages carry the StyleX CSS from the test compiler, both unlayered and inside @layer astryx-base, plus the theme CSS from the runtime provider or from astryx theme build. The theme styles size:sm 18×18 and size:lg 32×28; xsm and md are unstyled. Cells give the icon element's box, then the artwork's box where they differ, in px:

Page xsm sm md lg
main and branch, no theme, 16px root 12 16 20 24
main and branch, no theme, 20px root 15 20 25 30
main, runtime theme, unlayered StyleX 12 16 (theme ignored) 20 24 (theme ignored)
main, runtime theme, layered StyleX 12 box 18, semantic artwork 16; SVG 18 20 box 32×28, semantic artwork 24; SVG 32×28
branch, runtime theme, layered or unlayered 12 18 (all three) 20 box 32×28, semantic artwork 28×28; SVG 32×28
branch, built theme, layered or unlayered 12 18 (all three) 20 box 32×28, semantic artwork 28×28; SVG 32×28

With size:md at 1.25em (16px text), both semantic icons render 20px artwork in a 25px box and the SVG component renders at 20px, layered or not: the documented reason dimensions take px or rem.

Not covered here: WebKit and Firefox runs, and screenshots attached to this description. Unthemed pixels are unchanged by construction (identical measurements above); the visual gate on this pull request checks the stories.

Scope

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm exec vitest run --project ui packages/core/src/Icon packages/core/src/IconButton packages/core/src/Button packages/core/src/theme/derivedVarRegistry.test.ts: pass.
  • pnpm exec vitest run --project node packages/cli/api/theme/build/build.test.mjs: pass.
  • pnpm exec vitest run --project node packages/cli/test/experimental-isolation.test.mjs --update: the no-icon-set goldens gain the new theme docs section and its two search matches, and nothing else.
  • pnpm test:ui: everything this change touches passes. DateTimeInputTouch and CodeBlockHeaderPlugin failed under full-suite load and pass alone. The postinstall.test.mjs monorepo-nudge case also fails on main in this environment.
  • pnpm exec vitest run --project node packages/cli/api/docs packages/cli/foundation/doc-compiler packages/cli/foundation/discovery packages/cli/test: pass after the golden update, except packages/cli/test/global-local.test.mjs, which fails the same 18 cases on main in this environment.
  • pnpm -F @astryxdesign/core typecheck, pnpm -F @astryxdesign/cli typecheck (after building @astryxdesign/theme-neutral), pnpm check:repo, strict ESLint and Prettier on changed files: pass.

…dimension

spec:AST-087 FR10 and component:Icon FR7: the `icon` target guarantees
`width` and `height` on its size selectors. A theme writing them on
`components.icon['size:sm']` now resizes that size's glyph for semantic
icon names and for SVG components passed to Icon, at runtime and in
built themes.

The derived-var registry carries both properties as the private
`--_icon-width` / `--_icon-height` vars, and Icon's size styles read
them with each size's rem value as the fallback; registry glyphs also
take the smaller side as their font size so 1em artwork follows. Sizes
a theme does not style render as before.
@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 28, 2026 2:48am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 28, 2026, 3:12 AM UTC

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Oct 27, 2026
@imdreamrunner
imdreamrunner marked this pull request as ready for review October 27, 2026 22:54
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

Modified Components

Icon (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Entry File (ESM) 758B 758B 0B
Lines of Code 641 659 -
Complexity High High (26) -
IconButton (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Entry File (ESM) 435B 435B 0B
Lines of Code 17 17 -
Complexity Low Low (1) -

Component Size

Component Import before Import after Delta CSS before CSS after Delta
core/AlertDialog 57.3KB 57.3KB 0B 12.4KB 12.5KB +100B
core/AppShell 58.3KB 58.4KB +103B 11.6KB 11.8KB +175B
core/Banner 48.2KB 48.3KB +86B 9.9KB 10.1KB +171B
core/BaseTypeahead 54.7KB 54.8KB +90B 9.9KB 10.1KB +179B
core/BreadcrumbItem 66.8KB 66.9KB +96B 11.0KB 11.2KB +168B
core/Button 43.7KB 43.7KB 0B 9.2KB 9.3KB +99B
core/Calendar 55.3KB 55.4KB +104B 10.0KB 10.2KB +168B
core/Carousel 50.6KB 50.7KB +81B 10.2KB 10.3KB +161B
core/ChatComposer 61.1KB 61.2KB +99B 10.8KB 11.0KB +168B
core/ChatComposerInput 56.2KB 56.2KB 0B 10.1KB 10.2KB +101B
core/ChatComposerTokenElement 56.2KB 56.2KB 0B 10.1KB 10.2KB +101B
core/ChatDictationButton 46.9KB 47.0KB +102B 9.5KB 9.6KB +166B
core/ChatLayout 49.3KB 49.3KB +86B 9.9KB 10.1KB +167B
core/ChatLayoutScrollButton 46.8KB 46.9KB +86B 9.6KB 9.7KB +181B
core/ChatMessageMetadata 26.3KB 26.3KB +1B 3.9KB 4.0KB +162B
core/ChatSendButton 46.2KB 46.2KB 0B 9.2KB 9.3KB +99B
core/ChatToolCalls 32.3KB 32.3KB 0B 8.9KB 9.1KB +183B
core/CheckIndicator 9.0KB 9.0KB +11B 3.6KB 3.7KB +161B
core/CheckboxInput 50.4KB 50.4KB -7B 9.3KB 9.5KB +163B
core/CheckboxList 46.5KB 46.5KB -4B 8.1KB 8.3KB +164B
core/CheckboxListItem 54.5KB 54.5KB -9B 10.5KB 10.6KB +165B
core/Citation 26.4KB 26.4KB -1B 4.1KB 4.3KB +164B
core/CodeBlock 61.0KB 61.0KB +87B 10.7KB 10.8KB +192B
core/Collapsible 17.0KB 17.0KB -1B 4.2KB 4.4KB +174B
core/CommandPalette 51.4KB 51.4KB +9B 11.8KB 12.0KB +159B
core/CommandPaletteInput 32.8KB 32.8KB -2B 8.1KB 8.3KB +174B
core/ComplexSelector 56.3KB 56.3KB +87B 10.6KB 10.8KB +167B
core/ContextMenu 75.0KB 75.1KB +78B 14.6KB 14.8KB +178B
core/ContextMenuItem 53.3KB 53.4KB +95B 9.6KB 9.8KB +182B
core/DateInput 99.9KB 100.0KB +102B 14.8KB 14.9KB +163B
core/DateRangeInput 69.8KB 69.9KB +92B 11.2KB 11.4KB +166B
core/DateTimeInput 110.2KB 110.3KB +91B 15.2KB 15.4KB +172B
core/DialogHeader 49.2KB 49.3KB +90B 9.8KB 10.0KB +169B
core/DrawerHeader 49.3KB 49.4KB +89B 11.2KB 11.4KB +168B
core/DropdownMenu 73.1KB 73.2KB +98B 14.7KB 15.0KB +230B
core/DropdownMenuCheckboxItem 16.2KB 16.2KB +17B 5.6KB 5.7KB +165B
core/DropdownMenuItem 15.5KB 15.5KB +4B 5.2KB 5.3KB +168B
core/DropdownMenuRadioItem 16.2KB 16.3KB +13B 5.6KB 5.7KB +165B
core/DropdownMenuSubMenu 58.5KB 58.5KB +4B 9.5KB 9.7KB +166B
core/Field 44.7KB 44.7KB +1B 8.0KB 8.1KB +171B
core/FieldLabel 40.2KB 40.2KB +2B 6.5KB 6.7KB +167B
core/FieldStatus 10.4KB 10.4KB -2B 4.2KB 4.4KB +160B
core/FileInput 54.5KB 54.6KB +76B 10.3KB 10.5KB +173B
core/Icon 8.9KB 8.8KB -4B 3.6KB 3.7KB +161B
core/IconButton 43.7KB 43.7KB 0B 9.2KB 9.3KB +99B
core/InputGroup 45.3KB 45.3KB +7B 8.0KB 8.2KB +164B
core/LayerProvider 63.7KB 63.9KB +159B 10.1KB 10.3KB +168B
core/Lightbox 51.6KB 51.7KB +90B 9.8KB 10.0KB +182B
core/Link 43.9KB 43.9KB +1B 7.6KB 7.7KB +169B
core/ListItem 54.0KB 54.0KB +2B 10.5KB 10.6KB +165B
core/Markdown 144.8KB 144.9KB +82B 17.4KB 17.6KB +171B
core/MobileNav 51.4KB 51.5KB +111B 10.1KB 10.2KB +180B
core/MobileNavToggle 46.6KB 46.7KB +90B 9.4KB 9.6KB +164B
core/MoreMenu 73.5KB 73.6KB +94B 14.7KB 15.0KB +230B
core/MultiSelector 73.3KB 73.4KB +99B 14.6KB 14.8KB +181B
core/NumberInput 56.1KB 56.2KB +88B 10.7KB 10.9KB +173B
core/Pagination 85.3KB 85.3KB +82B 15.3KB 15.5KB +168B
core/Popover 50.3KB 50.3KB 0B 12.1KB 12.2KB +97B
core/PowerSearch 164.7KB 164.8KB +85B 19.9KB 20.1KB +193B
core/RadioList 46.0KB 46.0KB +3B 8.0KB 8.2KB +170B
core/RadioListItem 52.7KB 52.7KB -4B 9.7KB 9.8KB +163B
core/Selector 76.8KB 76.9KB +108B 15.0KB 15.2KB +207B
core/SelectorOption 14.5KB 14.5KB +2B 5.1KB 5.2KB +168B
core/SideNav 58.4KB 58.5KB +94B 10.6KB 10.7KB +167B
core/SideNavCollapseButton 47.1KB 47.2KB +86B 9.5KB 9.6KB +167B
core/SideNavHeading 55.1KB 55.2KB +100B 10.1KB 10.3KB +173B
core/SideNavItem 54.9KB 55.0KB +83B 10.1KB 10.3KB +174B
core/Slider 48.9KB 48.9KB -1B 8.5KB 8.7KB +168B
core/Step 32.9KB 32.9KB -5B 5.3KB 5.5KB +166B
core/Stepper 47.8KB 47.9KB +90B 9.6KB 9.7KB +180B
core/Switch 48.8KB 48.8KB -3B 9.3KB 9.5KB +165B
core/TabList 40.5KB 40.5KB +1B 7.2KB 7.3KB +163B
core/TabMenu 52.0KB 52.1KB +99B 10.0KB 10.2KB +168B
core/Table 84.3KB 84.4KB +94B 15.2KB 15.3KB +175B
core/TableCell 76.1KB 76.2KB +96B 14.9KB 15.1KB +178B
core/TableHeaderCell 75.8KB 75.9KB +103B 14.9KB 15.0KB +190B
core/TableSelectionToolbar 52.8KB 52.8KB 0B 11.2KB 11.3KB +105B
core/TextArea 49.8KB 49.8KB +3B 9.4KB 9.5KB +167B
core/TextInput 54.0KB 54.1KB +90B 10.5KB 10.6KB +169B
core/Thumbnail 51.1KB 51.2KB +104B 11.0KB 11.1KB +165B
core/TimeInput 87.2KB 87.3KB +90B 13.8KB 13.9KB +161B
core/Timestamp 27.9KB 27.9KB -1B 9.5KB 9.7KB +179B
core/Toast 60.3KB 60.4KB +157B 9.7KB 9.9KB +181B
core/ToggleButton 44.5KB 44.5KB 0B 9.3KB 9.4KB +99B
core/Token 30.0KB 30.0KB 0B 4.5KB 4.6KB +164B
core/Tokenizer 69.0KB 69.1KB +102B 16.5KB 16.7KB +177B
core/TopNav 52.3KB 52.4KB +103B 10.4KB 10.5KB +172B
core/TopNavHeading 54.6KB 54.7KB +99B 9.9KB 10.1KB +177B
core/TopNavMegaMenu 54.6KB 54.7KB +143B 10.8KB 11.0KB +167B
core/TopNavMenu 54.0KB 54.1KB +107B 10.1KB 10.3KB +165B
core/TreeList 38.7KB 38.7KB +3B 4.7KB 4.8KB +173B
core/Typeahead 61.9KB 62.0KB +99B 11.3KB 11.4KB +162B
lab/ChatEmojiPicker N/A 65.6KB N/A N/A 773B N/A
lab/ChatReactionBar N/A 66.2KB N/A N/A 1.1KB N/A
lab/CommentComposer N/A 94.6KB N/A N/A 1.9KB N/A
lab/CommentPin N/A 47.8KB N/A N/A 1.2KB N/A
lab/CommentThread N/A 216.5KB N/A N/A 2.4KB N/A
lab/Comments N/A 221.1KB N/A N/A 2.5KB N/A
lab/DiffViewer N/A 46.0KB N/A N/A 2.1KB N/A
lab/EmojiPicker N/A 63.4KB N/A N/A 722B N/A
lab/InfoTip N/A 21.8KB N/A N/A 458B N/A
lab/ListInput N/A 75.7KB N/A N/A 1.6KB N/A
lab/MobilePowerSearch N/A 147.1KB N/A N/A 1.4KB N/A
lab/MobileTokenizer N/A 92.6KB N/A N/A 809B N/A
lab/Schedule N/A 60.3KB N/A N/A 3.9KB N/A
lab/TourStep N/A 55.6KB N/A N/A 590B N/A
lab/TransferList N/A 67.3KB N/A N/A 1.7KB N/A
lab/TransferListSelector N/A 72.8KB N/A N/A 1.9KB N/A
richtext/RichTextEditor N/A 271.3KB N/A N/A 2.6KB N/A
richtext/RichTextEditorToolbar N/A 212.9KB N/A N/A 454B N/A
richtext/RichTextView N/A 251.7KB N/A N/A 2.3KB N/A

Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included.

Bundle Size Summary

Gzip figures measure each package's entry file, not the code an import pulls in.

Package Entry (ESM) Entry gzip before Entry gzip after Delta
@astryxdesign/core 4.9KB 1.2KB 1.2KB 0B
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/core 34.9KB 35.1KB +192B

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

57 of 504 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 753,933
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,072
RichTextEditor Markdown parity: side by side probe dark 558,840
RichTextEditor Markdown parity: side by side probe light 540,756
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
AppShell With Mobile Nav probe light 217,010
AppShell With Mobile Nav probe dark 216,960
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
AppShell Playground neutral dark 65,198
AppShell Playground neutral light 63,788
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232

and 37 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 27, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The registry route works: a theme's width and height on components.icon['size:*'] now size both semantic and SVG icons, whether or not StyleX is layered, and unstyled sizes are unchanged. Two small fixes are needed before this can be approved:

  • With an em dimension, a semantic icon's box resolves against its own enlarged font size, so size:md at 1.25em in 16px text gives a 25px box around 20px artwork beside a 20px SVG icon; please either document px/rem dimensions and add an em test, or keep that box from compounding.
  • apps/storybook/stories/IconSizeTheming.stories.tsx still tells theme authors to add fontSize because width and height alone cannot resize a semantic glyph, and with a non-square dimension that raw fontSize makes the glyph depend on StyleX layering again, so please drop it and describe the width-and-height form.

[Automated review]

Comment on lines +75 to +78
md: {
width: 'var(--_icon-width, 1.25rem)',
height: 'var(--_icon-height, 1.25rem)',
fontSize: 'min(var(--_icon-width, 1.25rem), var(--_icon-height, 1.25rem))',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a font-relative theme value this reads the same var twice: font-size: min(…) resolves 1.25em against the parent text (20px in 16px text), then width/height resolve 1.25em against that 20px. The semantic box ends up 25px around 20px artwork, while an SVG icon at the same size is 20px. Either document px/rem dimensions and add an em test, or keep the box from resolving against the font size it sets.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took the documentation option in 2975578. The size prop docs, astryx docs theme, the Icon JSDoc and the changeset now say an Icon dimension is given in px or rem, and why. Stopping the box from compounding would take a second element around the artwork: the box's em resolves against the font size the artwork needs, and architecture:component-style-authoring INV5/INV7 do not admit that wrapper. On the em test: jsdom resolves neither var() nor em, so the ui project cannot observe this case. I measured it in Chromium instead (size:md at 1.25em in 16px text: 20px artwork in a 25px box, SVG component 20px, layered or not) and added that to Evidence. The same commit drops fontSize from the size theming story and describes the width-and-height form.

Comment thread packages/cli/assets/docs/theme.doc.mjs Outdated
content: [
{
type: 'prose',
text: "A theme sets the dimension of each Icon size in its stylesheet: `width` and `height` on `components.icon['size:sm']` (or `xsm`, `md`, `lg`) resize that size's glyph, for semantic icon names and SVG components passed to `Icon` alike. A size the theme leaves alone stays 12, 16, 20, or 24px at a 16px root (`xsm`, `sm`, `md`, `lg`) and scales with the root font size; use `rem` values to keep that scaling. The four size names are fixed.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"alike" holds for px and rem only. With an em value, semantic icons get a larger box than SVG components (see the comment on IconSize.stylex.ts), so it is worth saying which lengths an Icon dimension takes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 2975578: the section now says to give the dimension in px or rem, and that an em value would also grow a semantic icon's box.

… workaround from the size theming story

A semantic icon takes its font size from the theme's dimension, so an
`em` dimension would also grow its box. The docs now say which lengths
the dimension takes. The size theming story no longer tells theme
authors to add `fontSize`: width and height alone size both glyph
modes, and a raw `fontSize` beside a non-square dimension would make
the glyph depend on StyleX layering again.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incremental review of bc1001c..2975578; prior findings carried: user_impact.

This looks ready to approve: both earlier points are resolved, with every surface that describes Icon size theming now saying to give the dimension in px or rem and why, and the Size Theming story teaching width and height alone while rendering the same frames as before. One behavior to keep in mind is that component-owned icon boxes such as Button's 16px icon wrapper keep their own size, so a theme that enlarges sm past 16px will see the glyph overflow there, which AST-087 leaves out of scope.

[Automated review]

…ensions

# Conflicts:
#	packages/cli/test/__golden__/no-icon-set/search-icon-set.json
#	packages/cli/test/__golden__/no-icon-set/search-icon-set.txt

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Icon size theming itself looks ready: width and height on components.icon['size:*'] now size both semantic and SVG icons in runtime and built themes, whether or not StyleX is layered, and unstyled sizes are unchanged. One small change is needed before approval: the merge from main rewrote packages/core/src/Kbd/Kbd.tsx:93 into a one-line braced form that neither parent has and Prettier rejects, so please restore main's version of that file (git checkout origin/main -- packages/core/src/Kbd/Kbd.tsx). Nothing in the Icon change needs to move.

[Automated review]

Comment thread packages/core/src/Kbd/Kbd.tsx Outdated
return isMac ? '\u2318' : t('@astryx.kbd.key.controlShort');
}
if (key === 'escape') return t('@astryx.kbd.key.escapeShort');
if (key === 'escape') {return t('@astryx.kbd.key.escapeShort');}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line comes from the merge commit, not from either parent: main has if (key === 'escape') return t('@astryx.kbd.key.escapeShort');. Behavior is the same, but Prettier rejects the one-line braces and Kbd is unrelated to Icon sizing, so restoring main's file (git checkout origin/main -- packages/core/src/Kbd/Kbd.tsx) takes it out of this pull request.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored main's file in 06a73fa. The pre-commit autofix had rewritten that line while committing the merge; the branch no longer touches Kbd.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Icon size theming works as intended: width and height on components.icon['size:*'] now size semantic and SVG icons in runtime and built themes whether or not StyleX is layered, unstyled sizes are unchanged, and restoring Kbd.tsx clears the earlier point. One change is needed before approval: iconRegistrySizeStyles is now exported from packages/core/src/Icon/IconSize.stylex.ts, which the package publishes as @astryxdesign/core/Icon/IconSize.stylex, so it would ship as new public API that no spec admits, and removing it later would need the compatibility process. Please declare it somewhere the package does not export, for example beside styles and colorStyles in Icon.tsx, so that subpath keeps the exports it has today.

[Automated review]

* so `fontSize` follows the glyph dimension too: the smaller side, which fits
* square artwork into a non-square box the way an SVG viewBox does.
*/
export const iconRegistrySizeStyles = stylex.create({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module is published as @astryxdesign/core/Icon/IconSize.stylex (the ./Icon/IconSize.stylex entry in packages/core/package.json), so this export ships as public API that no spec admits, and removing it later would need the compatibility process. Only Icon.tsx reads it, so declaring it there beside styles and colorStyles keeps the subpath's exports as they are today.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved in 1f446ae: the registry size styles now live beside styles and colorStyles in Icon.tsx and are not exported. @astryxdesign/core/Icon/IconSize.stylex exports exactly what it did before (IconSize, iconSizeStyles, iconBoxSizeStyles).

The published IconSize.stylex subpath keeps exactly the exports it had
before this change; only Icon reads the registry glyph sizes.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks ready to approve: width and height on components.icon['size:*'] now size both semantic and SVG icons in runtime and built themes, whether or not StyleX is layered, and icons without theme size styles render exactly as before. The registry size styles now live unexported in Icon.tsx, so @astryxdesign/core/Icon/IconSize.stylex keeps the exports it has on main. One behaviour to keep in mind is that component-owned icon boxes such as Button's 16px wrapper keep their size, so a theme that enlarges sm gets a glyph slightly larger than that box, which AST-087 leaves out of scope.

[Automated review]

@imdreamrunner
imdreamrunner merged commit db584bc into main Oct 28, 2026
80 of 81 checks passed
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 28, 2026
The only conflict is the CLI's icon-set search golden, which counts matching
docs: main's meta#8753 and meta#8759 add two icon docs (367 → 369), and this pull
request's on-screen keyboard section adds one. Regenerated at the merged tree
with the golden test's --update, as its header says to: the count is 370 and
the twenty results shown are main's.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 28, 2026
Main's Icon changes (meta#8753, meta#8759) moved the CLI's "icon set" search golden to 369 matches; this branch's "radio set" docs add one, so the regenerated golden records 370 (experimental-isolation.test.mjs --update on the merged tree; only the count changes).
@github-actions
github-actions Bot deleted the icons/ast087-size-dimensions branch October 28, 2026 06:17
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 28, 2026
Main's icon changes (meta#8753, meta#8756, meta#8758, meta#8759) moved the `icon set` search
golden. Regenerated with `vitest run
packages/cli/test/experimental-isolation.test.mjs --update`: only the two
count lines differ from main.

This branch was successfully deployed

1 active deployment
Preview — 1f446aed Deployed Oct 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant