Class Icon
A versatile icon component that displays graphical symbols with customizable styles and sizes.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class Icon : Image, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler
Remarks
The Icon component is a fundamental UI element that represents graphical symbols or pictograms in your application. It extends the Image component and provides additional functionality for displaying icons with various styles, sizes, and variants.
Icons are essential for creating intuitive user interfaces, helping users quickly identify actions, states, or categories within your application. The Icon component supports different variants (Regular, Bold, DuoTone, Light, Fill, and Thin) and sizes (XXS to L) to accommodate various design needs.
By default, Icons are non-focusable and ignore picking mode, making them ideal for decorative purposes while maintaining optimal performance.
Constructors
Icon()
Default constructor.
Declaration
public Icon()
Fields
primaryUssClassName
The Icon primary variant styling class.
Declaration
public const string primaryUssClassName = "appui-icon--primary"
Field Value
| Type | Description |
|---|---|
| string |
sizeUssClassName
The Icon size styling class.
Declaration
public const string sizeUssClassName = "appui-icon--size-"
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The Icon main styling class.
Declaration
public const string ussClassName = "appui-icon"
Field Value
| Type | Description |
|---|---|
| string |
Properties
iconName
The name of the Icon.
Declaration
[CreateProperty]
[UxmlAttribute]
public string iconName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
primary
The primary variant of the Icon.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool primary { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
size
The size of the Icon.
Declaration
[CreateProperty]
[UxmlAttribute]
public IconSize size { get; set; }
Property Value
| Type | Description |
|---|---|
| IconSize |
variant
The variant of the Icon.
Declaration
[CreateProperty]
[UxmlAttribute]
public IconVariant variant { get; set; }
Property Value
| Type | Description |
|---|---|
| IconVariant |
Methods
GetSizeUssClassName(IconSize)
Declaration
public static string GetSizeUssClassName(IconSize enumValue)
Parameters
| Type | Name | Description |
|---|---|---|
| IconSize | enumValue |
Returns
| Type | Description |
|---|---|
| string |