Skip to content

Icon ​

An icon component. It resolves an icon name into a glyph through the local icon system and supports sizes and semantic tones.

Spec source: lh-ui-core/specs/icon.json · Golden cases: lh-ui-core/cases/icon.json (5 cases, translated into xUnit tests)

Platform notes

The Windows end currently placeholders with unicode glyphs (LhIconTokens.GlyphFor, rendered by a TextBlock); production use should swap in FontIcon (Segoe Fluent Icons vector assets). This matches button's placeholder strategy. The registered icon names are listed in the Icon names section below.

Sizes ​

Three sizes map to the icon.size tokens.

9:41Icon sizes
⌕⌕⌕

HTML mock preview (Windows / WinUI 3 appearance), not an on-device render

csharp
var icon = new LhIcon
{
    Name = "search",
    Size = LhIconSize.Large,
};

Tones ​

Tone decides the glyph color and maps one-to-one onto the semantic color tokens; the default tone takes color.text.primary.

9:41Icon tones
✓ Default✓ Primary✓ Success
⚠ Warning✕ Dangerℹ Info
✓ Regular✓ Secondary

HTML mock preview (Windows / WinUI 3 appearance), not an on-device render

Icon names ​

The icon names currently registered in GlyphFor and their glyphs: search ⌕, refresh ↻, check ✓, close ✕, warning ⚠, info ℹ, back ←, more ⋯, star ★, edit ✎, delete ⌫, plus +, minus -, arrow →. Unregistered names fall back to ◆.

9:41Registered icons
⌕↻✓✕⚠ℹ←⋯
★✎⌫+-→

HTML mock preview (Windows / WinUI 3 appearance), not an on-device render

Light and dark themes ​

Toggle the site theme in the top-right corner and the icon colors inside the simulator phone frame change with it; on a real device, switch via LhTheme.Apply(true).

9:41Dark icons
★✓⚠

HTML mock preview (Windows / WinUI 3 appearance), not an on-device render; light/dark values are all taken from the core token snapshot

API ​

Props ​

PropDescriptionTypeDefault
NameIcon name (resolved by the local icon table; unregistered names fall back to ◆)string""
SizeIcon size; maps to the icon.size.* tokensLhIconSizeMedium
ToneIcon tone; maps to the semantic / text color tokensLhIconToneRegular

LhIconSize ​

ValueSize token
Smallicon.size.small (16epx)
Mediumicon.size.medium (18epx)
Largeicon.size.large (20epx)

LhIconTone ​

ValueColor token
Defaultcolor.text.primary
Primarycolor.primary.default
Successcolor.success.default
Warningcolor.warning.default
Dangercolor.danger.default
Infocolor.info.default
Regularcolor.text.regular
Secondarycolor.text.secondary

Token Reference ​

TokenUsage
icon.size.{small,medium,large}Three sizes
color.text.{primary,regular,secondary}Neutral tones
color.{primary,success,warning,danger,info}.defaultSemantic tones
typography.fontFamilyGlyph font stack

Golden Case Reference ​

How the 5 assertions of cases/icon.json map to xUnit tests (tests/LhIconTests.cs):

case idAssertionLocal test
click-emits-onclickThe gate passes (the icon is interactive)Click_Emits_OnClick
default-tone-uses-text-primaryThe default tone takes the primary text color tokenDefault_Tone_Uses_Text_Primary
primary-tone-uses-primary-tokenThe primary tone takes the primary color tokenPrimary_Tone_Uses_Primary_Token
small-size-uses-small-tokenSmall consumes the small size tokenSmall_Size_Uses_Small_Token
render-emits-icon-commandExactly one icon command is emittedRender_Emits_Single_Icon_Command

Plus dark-mode suites: Dark_Colors_Come_From_Dark_Tokens / Dimensions_Are_Identical_In_Dark_Mode. Run: cd lh-ui-windows && dotnet test.

lh-ui native bloodline · Windows (C# + WinUI 3)