-
Notifications
You must be signed in to change notification settings - Fork 1
Icons
eQuantic.UI provides a comprehensive and extensible icon ecosystem. It supports multiple popular icon sets out of the box, all integrated through a unified component model.
To use icons in your project, install the desired icon set package and the core components package.
dotnet add package eQuantic.UI.Components
dotnet add package eQuantic.UI.LucideRegister the icon providers in your Program.cs:
// Register icon sets as services
builder.Services.AddLucideIcons();
builder.Services.AddTablerIconsIcons();
// ... other icon sets
builder.Services.AddUI(options =>
{
options.ScanAssembly(typeof(Program).Assembly);
});Use the unified Icon component to render icons from any registered set. The component iterates through all registered IIconProvider services and uses the first one that resolves the name:
new Icon { Name = "search", ClassName = "w-4 h-4" }
new Icon { Name = "adjustments-vertical", Size = 20 }Additional properties: Size (default: 24), StrokeWidth (default: 2), Color (default: "currentColor").
Note: When multiple icon sets are registered and share icon names, the first registered provider that resolves the name wins. Use specialized components (below) for explicit targeting.
| Package | Description |
|---|---|
eQuantic.UI.Lucide |
Beautiful & consistent icons (default set). |
eQuantic.UI.Heroicons |
Beautiful hand-crafted SVG icons by the makers of Tailwind CSS. |
eQuantic.UI.RadixIcons |
A crisp set of 15×15 icons designed by the Radix UI team. |
eQuantic.UI.TablerIcons |
Over 4200 pixel-perfect icons for web design. |
eQuantic.UI.FontAwesome6.Solid |
The world's most popular icon set (Solid variant). |
eQuantic.UI.FontAwesome6.Regular |
Font Awesome 6 Regular icons. |
eQuantic.UI.FontAwesome6.Brands |
Font Awesome 6 Brand icons. |
Each icon set provides specialized components for direct, unambiguous usage:
new LucideIcon("search")
new HeroiconsIcon("adjustments-vertical")The icon system is built on a provider-based architecture:
-
IIconProvider: Interface ineQuantic.UI.Corefor resolving SVGs. -
IconComponent: Unified component ineQuantic.UI.Componentsthat uses registered providers. - Asset Management: Icons are rendered as lightweight SVGs directly in the DOM, maintaining full CSS styling compatibility (colors, sizes, animations).
You can implement your own icon provider by implementing IIconProvider and registering it in DI:
public class MyIconProvider : IIconProvider
{
public bool CanResolve(string name) => /* check if icon exists */;
public IComponent? CreateIcon(string name, int size = 24, double strokeWidth = 2,
string color = "currentColor", string? className = null)
{
// Return SVG component
}
}
// Register in Program.cs
builder.Services.AddSingleton<IIconProvider, MyIconProvider>();