Skip to content

Text ​

Display text primitive: consumes global typography tokens, with font-size levels, weight, tone and alignment.

Contract: lh-ui-core/specs/text.json · Golden cases: cases/text.json (5: token mappings translated to JVM tests; rendering and single-node assertions in androidTest)

Font-size levels ​

level maps to the typography.fontSize.<level> token; default base.

9:41Text

extraLarge

large

medium

base

small

extraSmall

HTML simulator preview (Android / Compose appearance), not a real device render

kotlin
LhText(content = "Title text", level = LhTextLevel.large)

Weight ​

weight maps to the typography.fontWeight.<weight> token (primary 400 / bold 600).

9:41Text

primary

bold

HTML simulator preview (Android / Compose appearance), not a real device render

Tone ​

tone maps to the color.text.<tone> token; selected takes color.selected.

9:41Text

primary

regular

secondary

placeholder

disabled

selected

HTML simulator preview (Android / Compose appearance), not a real device render

Alignment and line height ​

lhAlign aligns within the line box; line height always takes typography.lineHeight.primary (font size × 1.8).

9:41Text

center

end

HTML simulator preview (Android / Compose appearance), not a real device render

kotlin
LhText(content = "Centered", lhAlign = LhTextAlign.center)

API ​

Props ​

PropDescriptionTypeDefault
contenttext content (string form of the spec default slot)String""
modifiermodifierModifierModifier
levelfont-size levelLhTextLevelBase
weightfont weightLhTextWeightPrimary
tonetext toneLhTextTonePrimary
lhAlignhorizontal alignmentLhTextAlignStart

LhTextLevel ​

ValuefontSize token
ExtraLargetypography.fontSize.extraLarge (20sp)
Largetypography.fontSize.large (18sp)
Mediumtypography.fontSize.medium (16sp)
Basetypography.fontSize.base (14sp, default)
Smalltypography.fontSize.small (13sp)
ExtraSmalltypography.fontSize.extraSmall (12sp)

LhTextTone ​

Valuetext color token
Primarycolor.text.primary
Regularcolor.text.regular
Secondarycolor.text.secondary
Placeholdercolor.text.placeholder
Disabledcolor.text.disabled
Selectedcolor.selected

Token reference ​

TokenUsage
typography.fontSize.<level>six size levels
typography.fontWeight.{primary,bold}two weights
typography.lineHeight.primaryline height (font size × 1.8)
color.text.<tone> / color.selectedtext tones

Golden case reference ​

case idAssertionLocal test
default-level-uses-base-tokensdefault level consumes the base typography tokensLhTextDefaultsTest.default_level_uses_base_tokens / LhTextTest.default_level_renders_content
large-level-uses-large-tokenlarge level consumes the large size tokenLhTextDefaultsTest.large_level_uses_large_token / LhTextTest.large_level_renders_content
bold-weight-uses-bold-tokenbold consumes the bold weight tokenLhTextDefaultsTest.bold_weight_uses_bold_token
secondary-tone-uses-text-secondarysecondary tone takes the secondary text color tokenLhTextDefaultsTest.secondary_tone_uses_text_secondary
render-emits-single-text-commandrender emits a single TEXT commandLhTextTest.renders_single_text_node (single-node assertion)
bash
./gradlew :components:text:test                             # JVM part (token mappings)
./gradlew :components:text:connectedAndroidTest             # Instrumented part (requires a device)

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