Skip to content

[Icon] Bye bye tabler_icon ➡️ Welcome Symfony UX Icon 🎉  #194

@cavasinf

Description

@cavasinf

As already discussed in #17, we've got a gap in how to handle icons in this bundle:

  • Lib Tabler icons? not really (as it should because of the theme)
  • Lib FontAwesome icon (which version? How to switch to Tabler? ...)
  • <svg>? <i>?
  • Tabler's 'icon' class that doesn't work at all with FontAwesome

Possible solution

We've been using Symfony Ux icon for the past months and it's been a total game-changer!
It works like a charm and the best part is how easy it is to switch between icon sets (Bootstrap, Tabler, FontAwesome).
And we can send the search page to our clients and let them find what they like on their own.
Furthermore, they can provide us with their SVG icons, which we can incorporate into our Symfony application.

Great feature of today's bundle icons

The best part of tabler_icon today is the shortcut/library of words that are equal to an icon:

tabler:
   icons:
      issue: fas fa-bug

Same concept with UX Icon

# config/packages/ux_icons.yaml
ux_icons:
    # ...
    aliases:
        issue: tabler:bug-filled

https://symfony.com/bundles/ux-icons/current/index.html#icon-aliases

EDITED: Old way

But we ended to reproduce this same feature with UX Icon.

  1. By "importing" (downloading) the icon:

      php bin/console ux:icons:import tabler:bug

    Downloaded at: assets/icons/tabler/bug.svg

  2. Rename it to our "shortcut" and move it to the parent icon folder:
    assets/icons/issue.svg

  3. We can now call it like this:

    • {{ ux_icon('issue') }}
    • Or with twig component: <twig:ux:icon name="issue" />

TablerBundle pros

With that external bundle, we can get out of a tight spot with "custom" code that isn't related to the Tabler theme
Plus, we get to remove code to maintain!

TablerBundle cons

  • Deprecating tabler_icon 😢

WDYT ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    BC BreakThis will cause BC BreakFeatureFeature requestedStatus: Has PRWaiting in PR to be merge

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions