Skip to content

Text テキスト ​

テキスト表示プリミティブ:グローバル組版トークンを消費し、サイズレベル・字重・色調・整列をサポート。

契約元:lh-ui-core/specs/text.json · 黄金ケース:cases/text.json(5 件:トークン映射は JVM 単体テスト、レンダリングと単ノード検証は androidTest)

サイズレベル ​

level は typography.fontSize.<level> トークンにマッピング(デフォルト base)。

9:41Text

extraLarge

large

medium

base

small

extraSmall

HTML シミュレータプレビュー(Android / Compose の見た目)、実機レンダリングではありません

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

字重 ​

weight は typography.fontWeight.<weight> トークンにマッピング(primary 400 / bold 600)。

9:41Text

primary

bold

HTML シミュレータプレビュー(Android / Compose の見た目)、実機レンダリングではありません

色調 ​

tone は color.text.<tone> トークンにマッピング。selected は color.selected を使用。

9:41Text

primary

regular

secondary

placeholder

disabled

selected

HTML シミュレータプレビュー(Android / Compose の見た目)、実機レンダリングではありません

整列と行高 ​

lhAlign は行ボックス内で整列。行高は常に typography.lineHeight.primary(サイズ × 1.8)。

9:41Text

center

end

HTML シミュレータプレビュー(Android / Compose の見た目)、実機レンダリングではありません

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

トークン对照 ​

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

黄金ケース对照 ​

case idアサーションローカルテスト
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(単ノード検証)
bash
./gradlew :components:text:test                             # JVM 部分(トークン映射)
./gradlew :components:text:connectedAndroidTest             # 計測部分(デバイス必要)

lh-ui ネイティブ血脈 · Android 端(Kotlin + Compose)