Optris.Icons.Avalonia.MaterialDesign
12.0.6
dotnet add package Optris.Icons.Avalonia.MaterialDesign --version 12.0.6
NuGet\Install-Package Optris.Icons.Avalonia.MaterialDesign -Version 12.0.6
<PackageReference Include="Optris.Icons.Avalonia.MaterialDesign" Version="12.0.6" />
<PackageVersion Include="Optris.Icons.Avalonia.MaterialDesign" Version="12.0.6" />
<PackageReference Include="Optris.Icons.Avalonia.MaterialDesign" />
paket add Optris.Icons.Avalonia.MaterialDesign --version 12.0.6
#r "nuget: Optris.Icons.Avalonia.MaterialDesign, 12.0.6"
#:package Optris.Icons.Avalonia.MaterialDesign@12.0.6
#addin nuget:?package=Optris.Icons.Avalonia.MaterialDesign&version=12.0.6
#tool nuget:?package=Optris.Icons.Avalonia.MaterialDesign&version=12.0.6
Optris.Icons.Avalonia
Optris-maintained fork. The original Projektanker.Icons.Avalonia is unmaintained โ Projektanker GmbH has been dissolved and PRs to the upstream repo will not be reviewed. Optris GmbH has adopted this project to keep it alive for the Avalonia community, starting with an Avalonia 12 port.
Published to NuGet as
Optris.Icons.Avalonia,Optris.Icons.Avalonia.FontAwesome, andOptris.Icons.Avalonia.MaterialDesign. The C# namespace has been renamed fromProjektanker.Icons.AvaloniatoOptris.Icons.Avalonia(theProjektankername was misleading post-dissolution). The XAML XML namespace URLhttps://github.com/projektanker/icons.avaloniais preserved as an opaque identifier so existing consumer XAML keeps working without changes.
A library to easily display icons in an Avalonia App.
Live Demo โ try it in your browser
NuGet
Installation
dotnet add package Optris.Icons.Avalonia
dotnet add package Optris.Icons.Avalonia.FontAwesome
dotnet add package Optris.Icons.Avalonia.FontAwesome7
dotnet add package Optris.Icons.Avalonia.MaterialDesign
Install the core package and at least one icon provider. You only need the packs you plan to use. Font Awesome 6 and 7 can be used side-by-side.
Icon providers
| Name | Prefix | Example |
|---|---|---|
| FontAwesome 6 | fa |
fa-github |
| FontAwesome 7 | fa7 |
fa7-github |
| MaterialDesign | mdi |
mdi-github |
Quick start
A full example is available in the Demo project (live). For a detailed walkthrough, see the Getting Started guide.
1. Register icon providers on app start up
Register the icon provider(s) with the IconProvider.Current.
using Avalonia;
using Optris.Icons.Avalonia;
using Optris.Icons.Avalonia.FontAwesome;
using Optris.Icons.Avalonia.FontAwesome7;
using Optris.Icons.Avalonia.MaterialDesign;
namespace Demo.Desktop;
internal static class Program
{
public static void Main(string[] args)
{
BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
}
public static AppBuilder BuildAvaloniaApp()
{
IconProvider.Current
.Register<FontAwesomeIconProvider>()
.Register<FontAwesome7IconProvider>()
.Register<MaterialDesignIconProvider>();
return AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
}
}
2. Add xml namespace
Add xmlns:i="https://github.com/projektanker/icons.avalonia" to your view.
3. Use the icon
Standalone
<i:Icon Value="fa-solid fa-anchor" />
Attached to ContentControl (e.g. Button)
<Button i:Attached.Icon="fa-solid fa-anchor" />
Attached to MenuItem
<MenuItem Header="About" i:MenuItem.Icon="fa-solid fa-circle-info" />
Custom icon size
<i:Icon Value="fa-solid fa-anchor" FontSize="24" />
Animated
<i:Icon Value="fa-spinner" Animation="Pulse" />
<i:Icon Value="fa-sync" Animation="Spin" />
As an Image source
<Image>
<Image.Source>
<i:IconImage Value="fa-solid fa-anchor" Brush="(defaults to black)" />
</Image.Source>
</Image>
Done
Implement your own Icon Provider
Just implement the IIconProvider interface:
namespace Optris.Icons.Avalonia;
public interface IIconReader
{
IconModel GetIcon(string value);
}
public interface IIconProvider : IIconReader
{
string Prefix { get; }
}
and register it with the IIconProviderContainer:
IconProvider.Current.Register<MyCustomIconProvider>()
or
IIconProvider provider = new MyCustomIconProvider(/* custom ctor arguments */);
IconProvider.Current.Register(provider);
The IIconProvider.Prefix property has to be unique within all registered providers. It is used to select the right provider. E.g. FontAwesomeIconProvider's prefix is fa.
For a complete guide, see Custom Providers.
Documentation
Browse the full documentation on the Wiki, or jump to a specific page:
- Getting Started โ installation, setup, first icon
- Usage Guide โ controls, attached properties, animations, styling, data binding
- Icon Packs โ Font Awesome & Material Design reference, browse icons
- Custom Providers โ implement your own icon source
- API Reference โ classes, interfaces, and model types
- Troubleshooting โ common errors and fixes
Contributing
See CONTRIBUTING.md for development setup, building, testing, and release process.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Optris.Icons.Avalonia (>= 12.0.6)
-
net8.0
- Optris.Icons.Avalonia (>= 12.0.6)
-
net9.0
- Optris.Icons.Avalonia (>= 12.0.6)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Optris.Icons.Avalonia.MaterialDesign:
| Package | Downloads |
|---|---|
|
TestApp.Desktop
Package Description |
|
|
Zafiro.Avalonia.Icons.Optris
UI components, controls, dialogs, behaviors, and helpers for Avalonia applications. Includes reactive patterns, cross-platform support (desktop, mobile, browser), and source generators. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Optris.Icons.Avalonia.MaterialDesign:
| Repository | Stars |
|---|---|
|
SubtitleEdit/subtitleedit
the subtitle editor :)
|