Skip to content

[icons] Component use SVG version of icons - #5327

Closed
vvalentin-lucca wants to merge 6 commits into
release/22.1from
feat/icons-svg
Closed

vvalentin-lucca wants to merge 6 commits into
release/22.1from
feat/icons-svg

Conversation

@vvalentin-lucca

@vvalentin-lucca vvalentin-lucca commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

Switch in the rendering technique for icons called via the LF component: we’re switching from a font (managed by IcoMoon) to an SVG sprite (which is then used via <use href="#...">).

(HTML and CSS icons remain functional and still use the font.)


  • The sprite is automatically loaded and injected into the DOM—if it isn’t already there—upon the first call to an icon.
  • The CSS code dedicated to icons is moved to the /scss directory (and removed from /icons).
  • Alias handling is provided on the JavaScript side to manage legacy naming conventions.
  • The scripts have been modified so they no longer rely on the selection.json file currently provided by IcoMoon.

Capture d’écran 2026-09-10 à 15 44 21

@vvalentin-lucca vvalentin-lucca added the 🔖✨ Feature New feature (even a very small one) label Sep 10, 2026
@c-3po c-3po Bot added the 📖 Documentation changes Requires a Prisme update label Sep 10, 2026
@vvalentin-lucca vvalentin-lucca added this to the 22.1 milestone Sep 10, 2026
@github-actions

Copy link
Copy Markdown

🚀 Storybook preview deployed: https://pub-dc6d99acd6874e2aaff6219dd8a13ae2.r2.dev/PR-5327/index.html

@vvalentin-lucca
vvalentin-lucca changed the base branch from master to release/22.1 September 10, 2026 13:26
Supamiu
Supamiu previously approved these changes Sep 10, 2026
provideLuIconSpritePreload() lets consuming apps trigger the sprite
fetch on app init instead of waiting for the first <lu-icon>/<pr-icon>
to mount. Default lazy-load behavior is unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

.icon-color-placeholder {
color: var(--palettes-neutral-400);
vertical-align: text-bottom;

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.

I’m wondering about why aligning to text-bottom.

Would it be acceptable to align the icons on the first baseline ?, so that we have a natural font-like positionning?

@@ -0,0 +1 @@
<div [innerHTML]="spriteUrl | luSafeExternalSvg"></div>

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.

Wondering about the need to have an extra div for this component…

What is the benefit compared to injecting the SVG in the component directly?

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.

innerHTML cannot be placed on the host.

lu-bubble-icon,
lu-software-icon .softwareIcon,
lu-icon .lucca-icon,
lu-icon .icon,

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.

:is(lu-icon, pr-icon) .icon ?

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.

It seems like most lu-icon have been replaced by :where(lu-icon, pr-icon).

Wondering if we double-checked for selector that were lu-icon .lucca-icon (011). Specificity could drop to 010 instead of 011 and be breaking.

Comment on lines +33 to +37
&:not(svg) {
inset-block-start: 0.075rem;
}

&:is(svg) {

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.

Would using @namespace make sense?

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.

I didn't know that. Is it worth taking the risk?

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.

Probably not it what we have works.

Comment thread packages/icons/README.md
@@ -0,0 +1 @@
<div [innerHTML]="spriteUrl | luSafeExternalSvg"></div>

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.

  • Is this embedding the sprite within each icon?
  • If yes, should we load it once and have some sort of dependency from the icons? Meaning the icons return an error if the project does not load the SVG in its header. This would avoid many duplicated content, if feasible.

@vvalentin-lucca vvalentin-lucca added the 🤖 Produced by AI Some code was produced by AI. (Autocompleted code doesn't require to be labeled) label Sep 29, 2026
@jeremie-lucca

Copy link
Copy Markdown
Contributor

After discussions with Product XP: risks seems too important compared to the gain.
We keep the branch if we need specific improvements in the future like multi colored icons.

This branch was successfully deployed

2 active (1 outdated) deployments
staging — 5f115fe8 Deployed Sep 21, 2026 by vvalentin-lucca via Deploy Lucca Front staging #1249
production — be3eb81c Deployed Sep 21, 2026 by jeremie-lucca via publish #42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📖 Documentation changes Requires a Prisme update 🔖✨ Feature New feature (even a very small one) 🤖 Produced by AI Some code was produced by AI. (Autocompleted code doesn't require to be labeled)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants