Skip to content

Icon ​

A vector icon. A logical name maps to the platform's system symbol (SF Symbols on iOS); both its size and tone come from tokens.

Spec source: lh-ui-core/specs/icon.json · Golden cases: lh-ui-core/cases/icon.json (5 entries, translated into XCTest, runnable on the macOS host)

Tone ​

tone decides the icon color. default follows the primary text color, regular / secondary take the corresponding text tiers, and the rest take semantic colors.

9:41Icon tones

HTML mock preview (iOS / SwiftUI appearance), not an on-device render; on a device an SF Symbol vector is drawn

swift
LhIcon(name: "star", tone: .primary)

Sizes ​

Three sizes map to the icon.size tokens.

9:41Icon sizes

HTML mock preview (iOS / SwiftUI appearance), not an on-device render

Name mapping ​

name is a logical name aligned with the web bloodline; on the end it is mapped to an SF Symbol by LhIconMap.symbol(for:):

Logical nameSF Symbol
star / search / check / closestar / magnifyingglass / checkmark / xmark
arrow-up / arrow-down / arrow-left / arrow-rightarrow.up / arrow.down / arrow.left / arrow.right
refresh / plus / minus / eye / linkarrow.clockwise / plus / minus / eye / link

Unregistered names are not drawn (returns nil) and never crash.

swift
LhIcon(name: "search", lhSize: .large, tone: .secondary) {
  // lhOnClick
}

API ​

Props ​

PropDescriptionTypeDefault
nameLogical icon name (mapped to an SF Symbol via LhIconMap)String—
lhSizeIcon size, mapped to the size tokensLhIconSize.medium
toneIcon tone, mapped to the text / semantic color tokensLhIconTone.default
lhOnClickTap callback; when omitted, taps are not handled(() -> Void)?nil

LhIconSize ​

ValueSize
.smallicon.size.small (16pt)
.mediumicon.size.medium (20pt)
.largeicon.size.large (24pt)

LhIconTone ​

ValueColor
.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 ​

TokenPurpose
icon.size.{small,medium,large}Three sizes
color.text.{primary,regular,secondary}Text tones
color.{primary,success,warning,danger,info}.defaultSemantic tones

Golden Case Mapping ​

case idAssertionLocal test
click-emits-onclickA tap fires lhOnClick exactly onceView layer onTapGesture (gesture assertions need a simulator, see #Preview)
default-tone-uses-text-primaryThe default tone takes the primary text colortestDefaultToneUsesTextPrimary
primary-tone-uses-primary-tokenThe primary tone takes the primary tokentestPrimaryToneUsesPrimaryToken
small-size-uses-small-tokenThe small size takes the small size tokentestSmallSizeUsesSmallToken
render-emits-icon-commandOnly a single icon draw command is emittedtestRegisteredIconResolvesToSymbol / testUnknownIconReturnsNilSymbol

Plus dedicated dark-mode tests: testDarkColorsComeFromDarkTokens / testDimensionsAreIdenticalInDarkMode.

bash
swift test --filter LhIconTests    # Runs on the macOS host, no simulator required

lh-ui native bloodline · iOS (Swift + SwiftUI)