Skip to content

Replace Material Symbols icon font with inline SVGs - #14150

Open
schultek wants to merge 17 commits into
mainfrom
feat/svg-material-symbols
Open

schultek wants to merge 17 commits into
mainfrom
feat/svg-material-symbols

Conversation

@schultek

@schultek schultek commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Replaces the Material Symbols icon font with inline SVG icons across both docs and www sites to eliminate the external icon font download and layout shift:

  • Add dart run dash_site update-icons command in tool/dash_site to fetch Material Symbols SVGs (weight 600, outline and filled variants) and generate packages/site_shared/lib/src/material_symbols_data.dart. (Only for pulling in updated icons, rarely needed)
  • Update MaterialIcon (site_shared) and Icon (www) to render inline <svg> elements inside <span class="icon">.
  • Remove the Google Fonts Material Symbols stylesheet links and font-specific CSS rules.
  • Unify icon styling under the .icon class using --icon-size CSS custom property for sizing.
  • Update icon names to canonical Material Symbols names and add unit tests in packages/site_shared/test/material_icon_test.dart.

Note: This PR does not yet solve tree-shaking of unused icons from the client JS bundles (the string-keyed map is still retained). That is addressed in the follow-up stacked PR #14151.

Issues fixed by this PR (if any):

Contributes to #14120

PRs or commits this PR depends on (if any):

None

Presubmit checklist

  • If you are unwilling, or unable, to sign the CLA, even for a tiny, one-word PR, please file an issue instead of a PR.
  • If this PR is not meant to land until a future stable release, mark it as draft with an explanation.
  • This PR follows the Google Developer Documentation Style Guidelines—for example, it doesn't use i.e. or e.g., and it avoids I and we (first-person pronouns).
  • This PR uses semantic line breaks
    of 80 characters or fewer.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request migrates the site's icon system from using external Material Symbols icon fonts to rendering inline SVGs. It introduces a new update-icons command to download SVGs and generate a Dart file containing the SVG path data, updates the MaterialIcon and Icon components to use these inline SVGs, and removes the external font references and associated SASS styles. The review feedback highlights two critical compile-time issues in the icon generation script: literal newlines in SVG path data causing syntax errors in the generated file, and an invalid raw string literal r'\' that fails to compile in Dart.

@flutter-website-bot

flutter-website-bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Staged preview of the updated docs.flutter.dev site (updated for commit e59e854):

https://flutter-docs-prod--docs-pr14150-feat-svg-material-symb-ve3a9a03.web.app

@schultek

schultek commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Only real visible change: The icon for "Smooth Experiences" here https://flutter.dev/why-flutter#design-fidelity changed since it was only existing in the legacy material icons set (which the font included), not the new material symbols set (which we now use exclusively). Changed it to "animation" which seems to best fit the text. @abdallahshaban557

@flutter-website-bot

flutter-website-bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Staged preview of the updated flutter.dev site (updated for commit e59e854):

https://flutter-dev-230821--www-pr14150-feat-svg-material-symb-x815s7p8.web.app

@abdallahshaban557 abdallahshaban557 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.

thanks for doing that @schultek - I am approving this!

@parlough parlough self-assigned this Dec 1, 2026

@parlough parlough left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall looks like a great start! I was thinking to introduce typed access for tree shaking and discovery, but looks like you implemented that in #14151! I'll take a look at that PR soon.

Thanks @schultek!

@parlough parlough assigned schultek and unassigned parlough Dec 2, 2026
@schultek
schultek force-pushed the feat/svg-material-symbols branch 2 times, most recently from a993b05 to 88ce844 Compare December 2, 2026 14:42
…14120)

- Add `update-icons` command to `dash_site` to download Material Symbols Outlined SVGs into a temporary directory and generate Dart path data
- Prerender Material Symbols as inline SVGs in `MaterialIcon`, `Icon`, and Markdown alerts
- Remove Material Symbols font stylesheets from docs and www layouts
- Add unit tests for SVG icon path resolution and component rendering
- Remove font-based SCSS styles (font-family, font-variation-settings, ligatures)
- Remove unused font-based classes and attributes (ms-filled, notranslate, translate='no')
- Support --weight in `update-icons` (defaulting to 500 to match the optical size 24 font weight)
- Convert expansion-list collapse arrow from CSS font ligature to MaterialIcon
@schultek
schultek force-pushed the feat/svg-material-symbols branch from 88ce844 to 6070b39 Compare December 2, 2026 14:45
@schultek
schultek requested a review from parlough December 2, 2026 15:04
@schultek

schultek commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

@parlough Fyi this needs re-approval to be mergeable.

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.

5 participants