Skip to content

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.

9:41Cell basics
Title text
Right value
With label
This is the label text
No divider (bordered=false)

HTML mockup preview (HarmonyOS / ArkUI appearance) — not an on-device render

typescript
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.

9:41Cell variants
⌕
With icon
Clickable
→
*Required field
Clickable cell
→

HTML mockup preview (HarmonyOS / ArkUI appearance) — not an on-device render

API ​

Props ​

PropDescriptionTypeDefault
titleTitle (primary text)string''
valueRight value (right-aligned secondary text)string''
labelDescription text below the titlestring''
borderedWhether to draw the bottom dividerbooleantrue
clickableWhether clickable; when true, shows a right arrow and responds to tapsbooleanfalse
requiredWhether to show a red required asterisk before the titlebooleanfalse
iconLeft icon name (rendered by the local icon system)string?undefined
onClickTap callback; not fired when clickable is false() => voidEmpty function

Token reference ​

TokenPurpose
cell.paddingHorizontal / cell.paddingVerticalCell paddings (16 / 8vp)
cell.fontSizeTitle / cell.fontSizeLabel / cell.fontSizeValueFont sizes of the three segments (14 / 13 / 14)
cell.gapVertical gap between title and label
color.text.primary / color.text.secondaryTitle color / label and value color
color.border.lighterBottom divider color
color.danger.defaultRequired asterisk color
icon.size.mediumLeft 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 idAssertionLocal test
title-and-value-renderTitle and value consume the font-size tokenstitle_and_value_use_font_tokens
label-renders-secondary-toneLabel uses the secondary text colorlabel_uses_secondary_tone
required-uses-danger-tokenRequired asterisk uses the danger colorrequired_uses_danger_token
bordered-emits-line-commandDivider consumes the border tokenbordered_uses_border_lighter_token
clickable-emits-onclickClickable state fires the callbackclickable_state_is_resolved
not-clickable-no-onclickNot-clickable state does not fireclickable_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.

lh-ui native bloodline · HarmonyOS (ArkTS + ArkUI)