Cell
A list cell. On the left an icon + title (with an optional required asterisk and a subtitle), on the right a value and an arrow, with a bottom divider.
Spec source:
lh-ui-core/specs/cell.json· Golden cases:lh-ui-core/cases/cell.json(6 entries, translated into XCTest, runnable on the macOS host)
Basic usage
title is required; value / label / icon are optional. bordered controls the bottom divider (on by default).
HTML mock preview (iOS / SwiftUI appearance), not an on-device render
LhCell(title: "Title text", value: "Right value", clickable: true) {
// lhOnClick
}Icon / required / not clickable
icon goes through the LhIconMap mapping; required shows a red asterisk before the title; when clickable = false (the default) taps are not handled (golden case not-clickable-no-onclick).
HTML mock preview (iOS / SwiftUI appearance), not an on-device render
API
Props
| Prop | Description | Type | Default |
|---|---|---|---|
title | Title (required) | String | — |
value | Right-side value | String | "" |
label | Subtitle under the title | String | "" |
icon | Logical name of the left icon (mapped via LhIconMap) | String? | nil |
bordered | Whether to show the bottom divider | Bool | true |
clickable | Whether clickable (controls the arrow and the tap gate) | Bool | false |
required | Whether to show a red required asterisk before the title | Bool | false |
lhOnClick | Tap callback; not fired when clickable = false | (() -> Void)? | nil |
Text hierarchy
| Area | Font size | Color |
|---|---|---|
| Title | cell.fontSizeTitle (14pt) | color.text.primary |
| Subtitle | cell.fontSizeLabel (13pt) | color.text.secondary |
| Right value | cell.fontSizeValue (14pt) | color.text.secondary |
| Required asterisk | cell.fontSizeTitle | color.danger.default |
Token Reference
| Token | Purpose |
|---|---|
cell.paddingHorizontal / cell.paddingVertical | Padding (follows spacing.base / spacing.sm) |
cell.fontSizeTitle / cell.fontSizeLabel / cell.fontSizeValue | The three text font sizes |
cell.iconSize | Left icon size |
cell.gap | Gap between sections (follows spacing.sm) |
cell.borderWidth | Bottom divider width |
color.border.lighter | Bottom divider color |
color.text.{primary,secondary} | Title and value / subtitle colors |
color.danger.default | Required asterisk color |
color.background.default | Cell background |
Golden Case Mapping
| case id | Assertion | Local test |
|---|---|---|
title-and-value-render | Both the title and the value are drawn | testTitleAndValueUseFontTokens |
label-renders-secondary-tone | The subtitle takes the secondary text color | testLabelRendersSecondaryTone |
required-uses-danger-token | The required asterisk takes the danger token | testRequiredUsesDangerToken |
bordered-emits-line-command | The divider consumes the border.lighter token | testBorderedUsesBorderTokens |
clickable-emits-onclick | When clickable, the tap fires lhOnClick | testClickableIsInteractive |
not-clickable-no-onclick | When not clickable, the tap does not fire lhOnClick | testNotClickableIsNotInteractive |
Plus dedicated dark-mode tests: testDarkColorsComeFromDarkTokens / testDimensionsAreIdenticalInDarkMode / testCellInitAndRender / testLayoutUsesCellTokens.
swift test --filter LhCellTests # Runs on the macOS host, no simulator required
