Tesserae

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

class

Icon

public class Icon : IComponent, IHasForegroundColor, ITextFormating

A single icon glyph from the bundled UIcons set, with configurable size, weight and color.

Constructors

Constructor
Icon
public Icon()

Initializes a new instance of this class.

Constructor
Icon
public Icon(UIcons icon, UIconsWeight weight = UIconsWeight.Regular, TextSize size = TextSize.Small)

Initializes a new instance of this class.

Constructor
Icon
public Icon(Emoji icon, TextSize size = TextSize.Medium)

Initializes a new instance of this class.

Properties

Property
Icon.Foreground
public string Foreground { get ; set ; }

Gets or sets the CSS color (foreground) of the component.

Property
Icon.Size
public TextSize Size { get ; set ; }

Gets or sets the size of the component.

Property
Icon.Weight
public TextWeight Weight { get ; set ; }

Gets or sets the font weight of the component.

Property
Icon.TextAlign
public TextAlign TextAlign { get ; set ; }

Gets or sets the text alignment of the component.

Property
Icon.Title
public string Title { get ; set ; }

Gets or sets the title of the component.

Methods

Method
Icon.SetIcon
public Icon SetIcon(Emoji icon, TextSize size = TextSize.Medium)

Sets the icon of the component.

Method
Icon.SetIcon
public Icon SetIcon(UIcons icon, UIconsWeight weight = UIconsWeight.Regular, TextSize size = TextSize.Small)

Sets the icon of the component.

Method
Icon.Transform
public static string Transform(UIcons icon, UIconsWeight weight)

Configures the component to transform.

Method
Icon.SetTitle
public Icon SetTitle(string title)

Sets the title of the component.

Method
Icon.Render
public HTMLElement Render()

Renders the component's root HTML element.

See also

Referenced by

© 2026 Tesserae. All rights reserved.