Icon
Description
The Icon component renders a visual glyph using either the strongly typed UIcons set or an Emoji. It is useful for reinforcing actions, labeling content, and improving scanability without writing raw HTML or CSS classes by hand.
Usage
Create icons through the Icon(...) helper overloads or by instantiating Icon directly. You can update the glyph later with SetIcon(...), style it with foreground color and text-formatting helpers, and add a tooltip with SetTitle(...).
API reference
public class Icon : IComponent, IHasForegroundColor, ITextFormatingA single icon glyph from the bundled UIcons set, with configurable size, weight and color.
- Namespace
- Tesserae
- Implements
- IComponent, IHasForegroundColor, ITextFormating
Constructors
| Name | Description |
|---|---|
| Icon | Initializes a new instance of this class. |
| Overload | |
|---|---|
| Icon() | Initializes a new instance of this class. |
| Icon(UIcons, UIconsWeight, TextSize) | Initializes a new instance of this class. |
| Icon(Emoji, TextSize) | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| Foreground | Gets or sets the CSS color (foreground) of the component. |
| Size | Gets or sets the size of the component. |
| Weight | Gets or sets the font weight of the component. |
| TextAlign | Gets or sets the text alignment of the component. |
| Title | Gets or sets the title of the component. |
public string Foreground { get ; set ; }Gets or sets the CSS color (foreground) of the component.
public TextWeight Weight { get ; set ; }Gets or sets the font weight of the component.
public TextAlign TextAlign { get ; set ; }Gets or sets the text alignment of the component.
Methods
| Name | Description |
|---|---|
| SetIcon | Sets the icon of the component. |
| Transform | Configures the component to transform. |
| AI | Fills the glyph with the AI gradient instead of a flat colour - what marks an icon as standing for a model's work. Any glyph takes it; Sparkles is the one to use when the icon is there to say "AI" rather than to say what the thing is. The gradient is painted as a background clipped to the glyph, so setting Foreground afterwards has no visible effect - the fill is the gradient, not the colour. |
| SetTitle | Sets the title of the component. |
| Render | Renders the component's root HTML element. |
| Overload | |
|---|---|
| SetIcon(Emoji, TextSize) | Sets the icon of the component. |
| SetIcon(UIcons, UIconsWeight, TextSize) | Sets the icon of the component. |
public static string Transform(UIcons icon, UIconsWeight weight)Configures the component to transform.
public Icon AI(bool value = true)Fills the glyph with the AI gradient instead of a flat colour - what marks an icon as standing for a model's work. Any glyph takes it; Sparkles is the one to use when the icon is there to say "AI" rather than to say what the thing is. The gradient is painted as a background clipped to the glyph, so setting Foreground afterwards has no visible effect - the fill is the gradient, not the colour.