Skip to content

Text テキスト ​

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

契約元:lh-ui-core/specs/text.json · 黄金ケース:lh-ui-core/cases/text.json(5 件、XCTest に翻訳済み、macOS ホストで実行可能)

サイズレベル ​

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

9:41Text

extraLarge

large

medium

base

small

extraSmall

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

swift
LhText("Title text", level: .large)

字重 ​

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

9:41Text

primary

bold

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

色調 ​

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

9:41Text

primary

regular

secondary

placeholder

disabled

selected

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

整列と行高 ​

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

9:41Text

center

end

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

swift
LhText("Centered", lhAlign: .center)

API ​

プロパティ説明型デフォルト
contentテキスト内容(イニシャライザの第 1 引数、spec の default スロット)String""
levelサイズレベルLhTextLevel.base
weight字重LhTextWeight.primary
tone色調LhTextTone.primary
lhAlign整列と行高LhTextAlign.start

LhTextLevel ​

プロパティfontSize token
.extraLargetypography.fontSize.extraLarge (20pt)
.largetypography.fontSize.large (18pt)
.mediumtypography.fontSize.medium (16pt)
.basetypography.fontSize.base (14pt, default)
.smalltypography.fontSize.small (13pt)
.extraSmalltypography.fontSize.extraSmall (12pt)

LhTextTone ​

プロパティtext 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 tokensLhTextTests.testDefaultLevelUsesBaseTokens
large-level-uses-large-tokenlarge level consumes the large size tokenLhTextTests.testLargeLevelUsesLargeToken
bold-weight-uses-bold-tokenbold consumes the bold weight tokenLhTextTests.testBoldWeightUsesBoldToken
secondary-tone-uses-text-secondarysecondary tone takes the secondary text color tokenLhTextTests.testSecondaryToneUsesTextSecondary
render-emits-single-text-commandrender emits a single TEXT commandLhTextTests.testAllLevelsUseTheirTokens
bash
swift test --filter LhTextTests

lh-ui ネイティブ血脈 · iOS 端(Swift + SwiftUI)