Cell
List-row cell. The classic three-segment layout of title + label + right-aligned value, supporting icons, a required asterisk, a divider, and a tap arrow.
Spec source:
lh-ui-core/specs/cell.json· Golden cases:lh-ui-core/cases/cell.json(6 cases, translated into hypium tests)
Basic usage
title is the primary text, value is right-aligned, and label is the secondary description below the title.
HTML mockup preview (HarmonyOS / ArkUI appearance) — not an on-device render
LhCell({ title: 'Title text', value: 'Right value', label: 'Label text' })Icon / required / clickable
icon draws an icon on the left, required draws a red asterisk before the title (using color.danger.default), and when clickable is true, an arrow appears on the right and the cell responds to taps.
HTML mockup preview (HarmonyOS / ArkUI appearance) — not an on-device render
API
Props
| Prop | Description | Type | Default |
|---|---|---|---|
title | Title (primary text) | string | '' |
value | Right value (right-aligned secondary text) | string | '' |
label | Description text below the title | string | '' |
bordered | Whether to draw the bottom divider | boolean | true |
clickable | Whether clickable; when true, shows a right arrow and responds to taps | boolean | false |
required | Whether to show a red required asterisk before the title | boolean | false |
icon | Left icon name (rendered by the local icon system) | string? | undefined |
onClick | Tap callback; not fired when clickable is false | () => void | Empty function |
Token reference
| Token | Purpose |
|---|---|
cell.paddingHorizontal / cell.paddingVertical | Cell paddings (16 / 8vp) |
cell.fontSizeTitle / cell.fontSizeLabel / cell.fontSizeValue | Font sizes of the three segments (14 / 13 / 14) |
cell.gap | Vertical gap between title and label |
color.text.primary / color.text.secondary | Title color / label and value color |
color.border.lighter | Bottom divider color |
color.danger.default | Required asterisk color |
icon.size.medium | Left icon and right arrow size |
Golden case reference
How the 6 assertions in cases/cell.json map onto hypium tests (entry/src/test/Cell.test.ets):
| case id | Assertion | Local test |
|---|---|---|
title-and-value-render | Title and value consume the font-size tokens | title_and_value_use_font_tokens |
label-renders-secondary-tone | Label uses the secondary text color | label_uses_secondary_tone |
required-uses-danger-token | Required asterisk uses the danger color | required_uses_danger_token |
bordered-emits-line-command | Divider consumes the border token | bordered_uses_border_lighter_token |
clickable-emits-onclick | Clickable state fires the callback | clickable_state_is_resolved |
not-clickable-no-onclick | Not-clickable state does not fire | clickable_state_is_resolved (gate assertion) |
Plus dark-mode specifics: dark_colors_come_from_dark_tokens / dimensions_are_identical_in_dark_mode. To run: in DevEco Studio, right-click entry/src/test → Run Tests.

