Skip to content

[ux-icon] Using ux_icon through tabler_icon#247

Open
cavasinf wants to merge 14 commits intokevinpapst:mainfrom
TeamAllsoftware:ux-icon
Open

[ux-icon] Using ux_icon through tabler_icon#247
cavasinf wants to merge 14 commits intokevinpapst:mainfrom
TeamAllsoftware:ux-icon

Conversation

@cavasinf
Copy link
Collaborator

@cavasinf cavasinf commented Jan 12, 2026

Description

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I updated the documentation (see here)
  • I agree that this code will be published under the MIT license

@cavasinf cavasinf added this to the 3.0 milestone Jan 12, 2026
@cavasinf cavasinf added Status: Needs Review Not under investigation Feature Feature requested BC Break This will cause BC Break labels Jan 12, 2026
@cavasinf cavasinf self-assigned this Jan 12, 2026
@kevinpapst
Copy link
Owner

Nice, but what was wrong with the old PR #195 ?

@cavasinf
Copy link
Collaborator Author

I’m trying to make this as “no changes needed” as possible for other developers.
It relies on Symfony UX and still works with the existing tabler.yaml icons configuration.

@cavasinf cavasinf changed the title [ux-icon] Replace tabler_icon by ux_icon [ux-icon] Using ux_icon through tabler_icon Jan 13, 2026
@cavasinf cavasinf modified the milestones: 3.0, 2.1 Jan 13, 2026
@cavasinf cavasinf marked this pull request as ready for review January 19, 2026 14:29
@cavasinf cavasinf requested a review from kevinpapst January 19, 2026 14:30
{% macro item_icon(item) %}
{% if item.icon %}
<span class="nav-link-icon d-md-none d-lg-inline-block text-center">{{ tabler_icon(item.icon, false, item.icon) }}</span>
<span class="nav-link-icon d-md-none d-lg-inline-block text-center">{{ tabler_icon(item.icon, true, item.icon) }}</span>
Copy link
Owner

Choose a reason for hiding this comment

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

Why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because this is now the correct way to use the .icon class with Symfony UX Icons, which render SVGs instead of webfonts.
So the icon class has always been required on menu icon elements from the start.

image

Copy link
Owner

@kevinpapst kevinpapst Jan 20, 2026

Choose a reason for hiding this comment

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

I thought so. This is a rather visually unacceptable BC break for everyone, who cannot immediately switch to ux-icons, like me... Can we either make this somehow configurable OR provide a CSS snippet to fix the problem?

image

Looks worse, when its not so zoomed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looks worse, when its not so zoomed

Wait, this behavior happens when the .icon class is used with webfonts.
In your screenshot, is it a webfont or an SVG?

With this PR, all <i> elements are replaced by <svg>, so the zoom effect should no longer occur.

image

"symfony/twig-bridge": "^6.0 || ^7.0 || ^8.0",
"twig/twig": "^3.0"
"twig/twig": "^3.0",
"symfony/ux-icons": "^2.0"
Copy link
Owner

Choose a reason for hiding this comment

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

We should move symfony/ux-icons to suggest section and make the dependency optional.
I will see if I find a way.

Copy link
Collaborator Author

@cavasinf cavasinf Jan 20, 2026

Choose a reason for hiding this comment

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

I was doing that at the beginning, but since we allow icon alias references from MenuItem, we NEED to be able to generate the icon and not only recommend it.

That said, my idea would be to allow developers to pass an html string to that parameter. Why?

  • It gives them full control over what is rendered in the menu
  • They are not forced to use FontAwesome (as today) or a future ux-icon solution

TBH, I was thinking the same approach could apply to every component that accepts an icon alias. We should only accept an HTML string (still BC-compatible if an alias is provided) and simply render icon|raw inside the component.

For your example with that f***ing icon class, you will be able to add/remove it yourself, and not being forced by the menu template.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could make it required now, and suggest it for 3.0 later

cavasinf and others added 3 commits January 20, 2026 11:37
Co-authored-by: Kevin Papst <kevinpapst@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BC Break This will cause BC Break Feature Feature requested Status: Needs Review Not under investigation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants