Optris.Icons.Avalonia.MaterialDesign 12.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Optris.Icons.Avalonia.MaterialDesign --version 12.0.2
                    
NuGet\Install-Package Optris.Icons.Avalonia.MaterialDesign -Version 12.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Optris.Icons.Avalonia.MaterialDesign" Version="12.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Optris.Icons.Avalonia.MaterialDesign" Version="12.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Optris.Icons.Avalonia.MaterialDesign" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Optris.Icons.Avalonia.MaterialDesign --version 12.0.2
                    
#r "nuget: Optris.Icons.Avalonia.MaterialDesign, 12.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Optris.Icons.Avalonia.MaterialDesign@12.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Optris.Icons.Avalonia.MaterialDesign&version=12.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Optris.Icons.Avalonia.MaterialDesign&version=12.0.2
                    
Install as a Cake Tool

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, and Optris.Icons.Avalonia.MaterialDesign. The C# namespace has been renamed from Projektanker.Icons.Avalonia to Optris.Icons.Avalonia (the Projektanker name was misleading post-dissolution). The XAML XML namespace URL https://github.com/projektanker/icons.avalonia is preserved as an opaque identifier so existing consumer XAML keeps working without changes.


A library to easily display icons in an Avalonia App.

๐Ÿงช Test ๐Ÿ”„ Sync FontAwesome ๐Ÿ”„ Sync Material Design

NuGet

Name Description Version
Optris.Icons.Avalonia Core library Nuget
Optris.Icons.Avalonia.FontAwesome Font Awesome 6 Free Nuget
Optris.Icons.Avalonia.MaterialDesign Material Design Icons Nuget

Icon providers

Name Prefix Example
FontAwesome 6 fa fa-github
MaterialDesign mdi mdi-github

Usage

A full example is available in the Demo project.

1. Register icon providers on app start up

Register the icon provider(s) with the IconProvider.Current.

class Program
{
    // Initialization code. Don't use any Avalonia, third-party APIs or any
    // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
    // yet and stuff might break.
    public static void Main(string[] args)
    {
        BuildAvaloniaApp()
            .StartWithClassicDesktopLifetime(args);
    }

    // Avalonia configuration, don't remove; also used by visual designer.
    public static AppBuilder BuildAvaloniaApp()
    {
        IconProvider.Current
            .Register<FontAwesomeIconProvider>()
            .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-brands fa-anchor" />

Attached to ContentControl (e.g. Button)

<Button i:Attached.Icon="fa-brands fa-anchor" />

Attached to MenuItem

<MenuItem Header="About" i:MenuItem.Icon="fa-solid fa-circle-info" />

Custom icon size

<i:Icon Value="fa-brands 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-brands fa-anchor" Brush="(defaults to black)" />
  </Image.Source>
</Image>

Done

Screenshot

Implement your own Icon Provider

Just implement the IIconProvider interface:

namespace Optris.Icons.Avalonia
{
    /// <summary>
    /// Represents an icon reader.
    /// </summary>
    public interface IIconReader
    {
        /// <summary>
        /// Gets the model of the requested icon.
        /// </summary>
        /// <param name="value">The value specifying the icon to return it's model from.</param>
        /// <returns>The model of the icon.</returns>
        /// <exception cref="System.Collections.Generic.KeyNotFoundException">
        /// The icon associated with the specified <paramref name="value"/> does not exists.
        /// </exception>
        IconModel GetIcon(string value);
    }

    /// <summary>
    /// Represents an icon provider.
    /// </summary>
    public interface IIconProvider : IIconReader
    {
        /// <summary>
        /// Gets the prefix of the <see cref="IIconProvider"/>.
        /// </summary>
        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.

Releasing a new version

The major version tracks Avalonia (e.g. 12.x.y for Avalonia 12). Minor and patch versions are for library changes.

  1. Tag the release: git tag -a v12.0.1 -m "v12.0.1"
  2. Push the tag: git push origin v12.0.1

The release workflow extracts the version from the tag, packs all three packages with it, and publishes to nuget.org. No need to edit version numbers in source files.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 :)
Version Downloads Last Updated
12.0.6 2,670 4/22/2026
12.0.5 262 4/14/2026
12.0.4 1,024 4/9/2026
12.0.3 101 4/9/2026
12.0.2 100 4/9/2026
12.0.1 96 4/8/2026
12.0.0 113 4/8/2026