Allow setting the default icon set #495
Replies: 1 comment
|
Hi @davidjamesb — sorry for the slow reply, v4 ate the last few weeks. Short version: yes, I want this, and I would be glad for you to take it. Thank you for asking before building. I went and measured the surface before answering, because the numbers decide between your two options:
On your option 2 — a fragment per iconI would not go this way as the primary mechanism. 180 usages means roughly 60 new On your option 1 — a global switchThis is the right shape, but I would not key it on icon sets. That needs a like-for-like mapping of all 63 icons across Lucide, Font Awesome, Heroicons and Feather, maintained forever. Coverage is not 1:1 — Feather ships 286 icons against Lucide's 1,750 — and the day a component starts using a 64th icon, three of those four mappings silently fall back without anyone noticing. What I would build insteadA provider keyed on a closed set of semantic roles the library owns. public enum BbIconRole { ChevronDown, Check, Close, Search, Calendar, /* …63 of them */ }
public interface IBbIconRenderer
{
RenderFragment Render(BbIconRole role, int size, string? cssClass);
}Components render builder.Services.AddBlazorBlueprintComponents();
builder.Services.AddBlazorBlueprintFontAwesomeIcons(); // or your own IBbIconRendererWhy roles rather than set names:
The existing If you want to take itI would split it so the reviewable decision comes first:
Branch off Related: this is a concrete instance of #488 (global defaults), and it lands in the same registration shape, so the two should stay consistent. |
Uh oh!
There was an error while loading. Please reload this page.
Hey @mathewtaylor.
I previously contributed the Font Awesome icon package which we are using across our application.
We're in a scenario now where we have a mix of icons - with our custom components using Font Awesome and the default out of the box Blueprint components using Lucide.
It's not a huge deal, but it does mean we have inconsistencies in our design. It would be great if we had an option to override the default icons used across Blueprint and wanted to get your thoughts before I take a stab at it myself.
I can see two possible approaches:
This global configuration idea has also been raised in #488.
Neither approaches seem trivial but I know we already expose IconContent in some components so maybe that approach is preferred.
Any other ways you would recommend that we could extend Blueprint so we can align icons across our design?
Thanks.
All reactions