Skip to content

Pilot JSON component tokens for Button and MenuButton - #4522

Merged
Jason Morse (JasonVMo) merged 8 commits into
mainfrom
jasonmo-microsoft-component-token-layer
Nov 21, 2026
Merged

Jason Morse (JasonVMo) merged 8 commits into
mainfrom
jasonmo-microsoft-component-token-layer

Conversation

@JasonVMo

@JasonVMo Jason Morse (JasonVMo) commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Platforms Impacted

  • iOS
  • macOS
  • win32 (Office)
  • windows
  • android

Description of changes

  • Load the reviewed Button and MenuButton JSON token companions at runtime. Resolve dotted selectors from typed component state, share field validators, and cache compiled tokens per theme state. Component defaults, theme overrides, and caller visuals apply in that order.
  • Share Button's trigger chrome with MenuButton while keeping its chevron tokens independent. Resolve only the winning interaction color values.
  • Extract the referenced Fluent SVG assets with provenance. The production MenuButton renders the decorative 16-unit chevron at small size and the 20-unit chevron at medium and large sizes. Group both adapters in menu-button.assets.tsx and render them with framework-base directComponent to avoid extra React component boundaries. The standard stories exercise the production trigger.
  • Enable RNSVG autolinking for Windows Fabric Storybook and use the native SVG views already available in the Win32 Paper host.
  • Run macOS native Storybook smoke against its instance-specific embedded bundle instead of starting a second cold Metro build at launch. Interactive development still uses Metro.

Verification

  • yarn clean-lage-cache && yarn lage buildci, followed by yarn lage buildci --concurrency 1 — passed on retry after unrelated transient desktop-test fixture failures. The redundant button.tokens.types.test.ts was removed; runtime token validation and component tests remain.
  • Hosted macOS Storybook on 3ebadea04: Fabric, Fabric physical input, and Paper all passed. The required PR aggregate passed.
  • With $env:STORYBOOK_SMOKE_STORY = 'components-menubutton--*', yarn storybook smoke --win32 --mode stories-and-tests passed 189 stories and 8/8 MenuButton tests on Win32 Paper; yarn storybook smoke --windows --mode stories-and-tests passed 216 stories and 8/8 MenuButton tests on Windows Fabric. These native runs were on the SVG-default commit 0759f03d8.
  • The current run's separate, non-required Win32 physical-input lane stopped at components-tab--overview because the Storybook context did not settle. Manual screen-reader checks were not run.
Before After
Separate TypeScript style factories assembled Button and MenuButton visuals; YAML companions documented the mappings. Both components load JSON token definitions at runtime. MenuButton shares Button's themed trigger chrome while resolving its own chevron tokens.
MenuButton drew a font glyph; SVG artwork was available only in a separate preview. Every MenuButton draws the size-specific Fluent SVG chevron. The preview is removed, and the regular stories cover the production trigger.

Pull request checklist

This PR has considered (when applicable):

  • Automated Tests
  • Documentation and examples
  • Keyboard Accessibility
  • Voiceover
  • Internationalization and Right-to-left Layouts

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Bundle size report

Tree-shaken, minified production esbuild bundles with React and React Native runtimes externalized.

Scenario Modules-Mac (Δ) Modules-Win (Δ) Size-Mac (Δ) Size-Win (Δ)
components-button 81 (+3) 82 (+3) 79.16k (+5.53k) 79.09k (+5.54k)
components-catalog 240 (+13) 241 (+13) 240.31k (+10.99k) 240.23k (+10.99k)
design-themed-root 55 (+4) 56 (+4) 56.66k (+1.39k) 56.58k (+1.39k)
design-color-lib 6 (+0) 6 (+0) 6.27k (+0b) 6.27k (+0b)
design-theme-state-legacy-source 49 (+1) 50 (+1) 53.01k (-795b) 52.93k (-795b)
design-legacy-theme 42 (+0) 42 (+0) 39.11k (+0b) 42.91k (+0b)
design-legacy-theme-from-flex 58 (+4) 58 (+4) 61.05k (+1.17k) 64.86k (+1.17k)
design-fluent-light-theme 7 (+0) 7 (+0) 18.74k (+0b) 22.59k (+0b)
design-fluent-theme 35 (+0) 35 (+0) 27.46k (+4b) 31.25k (-1b)
design-fluent-hc-theme 32 (+0) 32 (+0) 27.34k (+0b) 31.13k (+0b)
design-flex-theme 29 (-4) 29 (-4) 14.30k (-9.07k) 14.29k (-9.07k)
design-flex-cool-theme 26 (New) 26 (New) 12.51k (New) 12.50k (New)
design-flex-warm-theme 26 (-7) 26 (-7) 12.28k (-11.15k) 12.27k (-11.15k)

The job is advisory: size changes are reported but do not fail the pull request. Bundle or analysis errors still fail.


View bundle-size workflow run

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@JasonVMo
Jason Morse (JasonVMo) force-pushed the jasonmo-microsoft-component-token-layer branch from 4bb6079 to afe7be0 Compare November 20, 2026 20:57
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b8dbd691-ed45-44fa-8ac2-b14a85f21e85
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@JasonVMo
Jason Morse (JasonVMo) marked this pull request as ready for review November 20, 2026 23:00
@JasonVMo
Jason Morse (JasonVMo) merged commit c64353f into main Nov 21, 2026
36 of 37 checks passed
@JasonVMo
Jason Morse (JasonVMo) deleted the jasonmo-microsoft-component-token-layer branch November 21, 2026 00:15
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