Skip to content

Icon ​

The base icon component. Icons in other components (cell / input / navbar, etc.) are all rendered through this component's local registry.

Spec source: lh-ui-core/specs/icon.json · Golden cases: cases/icon.json (5 cases, translated into JVM unit tests + Compose UI Test)

Size and tone ​

Three sizes map to the icon.size.* tokens; the default tone takes color.text.primary, and the others take semantic colors.

9:41Icon sizes
Default color (text.primary)

HTML mock preview (Android / Compose look), not an on-device render

kotlin
LhIcon(name = "search", lhSize = LhIconSize.large, tone = LhIconTone.primary)

Semantic tones ​

9:41Icon tones
default
primary
success
warning
danger

HTML mock preview (Android / Compose look), not an on-device render

Icon registry ​

LhIcons is the local registry mapping icon names to Material ImageVectors. Unregistered names return null (nothing is drawn, no exception thrown):

Icon nameMaterial vector
search / refresh / check / check-circleSearch / Refresh / Check / CheckCircle
close / clear / star / warningClose / Clear / Star / Warning
info / plus / minusInfo / Add / Remove
arrow-left / arrow-right / chevron-rightArrowBack / ArrowForward / ChevronRight

API ​

Props ​

PropDescriptionTypeDefault
nameIcon name (resolved by the LhIcons registry)String—
lhSizeIcon sizeLhIconSizeMedium
toneSemantic toneLhIconToneDefault
contentDescriptionAccessibility description; defaults to the icon name — pass null explicitly to declare a decorative iconString?name
lhOnClickTap callback; not tappable when null(() -> Unit)?null
modifierModifierModifierModifier

LhIconSize ​

ValueSize token
Smallicon.size.small (16dp)
Mediumicon.size.medium (20dp)
Largeicon.size.large (24dp)

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.primarydefault tone
color.{primary,success,warning,danger,info}.defaultSemantic tones
color.text.{regular,secondary}regular / secondary tones

Golden case reference ​

case idAssertionLocal test
click-emits-onclickA tap triggers onClickLhIconTest.click_emits_onClick (Compose UI Test)
default-tone-uses-text-primaryThe default tone takes the primary text tokenLhIconDefaultsTest.default_tone_uses_text_primary_token
primary-tone-uses-primary-tokenThe primary tone takes the primary tokenLhIconDefaultsTest.primary_tone_uses_primary_token
small-size-uses-small-tokenSmall takes the small size token (with a reverse assertion that large is not applied)LhIconDefaultsTest.small_size_uses_small_token
render-emits-icon-commandA registered icon name resolves to a vector; an unregistered name draws nothingLhIconDefaultsTest.registered_name_resolves_to_vector + LhIconTest.unknown_name_is_safe
bash
./gradlew :components:icon:test                            # JVM part
./gradlew :components:icon:connectedAndroidTest            # Interaction part (requires a device)

lh-ui native bloodline · Android (Kotlin + Compose)