Skip to content

docs(Icon): storybook demo for theming the icon size scale - #5465

Merged
cixzhang merged 2 commits into
mainfrom
icon-size-theming
Aug 25, 2026
Merged

docs(Icon): storybook demo for theming the icon size scale#5465
cixzhang merged 2 commits into
mainfrom
icon-size-theming

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

Icon size is already themeable — defineTheme component overrides land in @layer astryx-theme, above StyleX — but nothing showed it, so the question "can Icon size be a theme property?" had no answer you could look at. This adds one.

What

A Core/Icon/Size Theming story with two views, each rendering the same content under three themes side by side (default 12/16/20/24, a compact 10/12/14/16, a spacious 16/22/28/36):

  • Size Scale — the four sizes in both icon modes: a registry icon (icon="search") and an SVG component (icon={BellIcon}).
  • Built-in component icons — icons a consumer never renders directly: the TextInput start icon, the Selector chevron, the DateInput calendar toggle, the TimeInput clock. All four are internal <Icon size="sm">, so one size:sm rule retunes them together.

The story docs carry the copy-pasteable defineTheme snippet and the one non-obvious rule: set fontSize alongside width/height, because registry icons are 1em-based SVGs inside a span — the box alone resizes the span and not the glyph.

Risk

None. A new story file; no component, token, or theme change.

Testing

Measured in Chromium against local Storybook. Rendered box per theme matches the declared scale exactly:

xsm sm md lg
default 12 16 20 24
compact 10 12 14 16
spacious 16 22 28 36

Both icon modes agree, and the four in-component glyphs measure 16 / 12 / 22px under the three themes.

@vercel

vercel Bot commented Aug 25, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Aug 25, 2026 2:15am

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.


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

github-actions Bot added a commit that referenced this pull request Aug 25, 2026
@cixzhang
cixzhang merged commit b0a09a6 into main Aug 25, 2026
21 checks passed
github-actions Bot added a commit that referenced this pull request Aug 25, 2026
@github-actions
github-actions Bot deleted the icon-size-theming branch August 25, 2026 06:12
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant