Loading
Circular spinning loading indicator. Supports three sizes and five semantic tones.
Spec source:
lh-ui-core/specs/loading.json· Golden cases:lh-ui-core/cases/loading.json(8 cases, translated into hypium tests)
The spin animation is driven natively by ArkUI's LoadingProgress (the spec's "spin delegated to the backend" is carried by the platform animation on this end).
Sizes
Three sizes map to the loading.size tokens.
HTML mockup preview (HarmonyOS / ArkUI appearance) — not an on-device render
LhLoading({ size: LhLoadingSize.Large })Tones
tone decides the ring color, mapping one-to-one onto the semantic color tokens.
HTML mockup preview (HarmonyOS / ArkUI appearance) — not an on-device render
API
Props
| Prop | Description | Type | Default |
|---|---|---|---|
size | Indicator diameter, maps to the loading.size tokens | LhLoadingSize | Medium |
tone | Ring color, takes the matching semantic color token | LhLoadingTone | Primary |
text | Loading label; falls back to language pack when unset; empty string hides the label | string | Language pack (@lh-i18n) |
LhLoadingSize
| Value | size |
|---|---|
Small | loading.size.small (16vp) |
Medium | loading.size.medium (20vp) |
Large | loading.size.large (24vp) |
LhLoadingTone
| Value | Ring color |
|---|---|
Primary | color.primary.default |
Success | color.success.default |
Warning | color.warning.default |
Danger | color.danger.default |
Info | color.info.default |
Token reference
| Token | Purpose |
|---|---|
loading.size.{small,medium,large} | Three diameters |
loading.strokeWidth | Ring stroke width (2vp) |
color.{primary,success,warning,danger,info}.default | Five ring colors |
Golden case reference
How the 8 assertions in cases/loading.json map onto hypium tests (entry/src/test/Loading.test.ets):
| case id | Assertion | Local test |
|---|---|---|
medium-size-uses-medium-token | Medium takes the medium size token | medium_size_uses_medium_token |
large-size-uses-large-token | Large takes the large size token | large_size_uses_large_token |
primary-tone-uses-primary-token | The primary tone takes the primary color token | primary_tone_uses_primary_token |
success-tone-uses-success-token | The success tone takes the success color token | success_tone_uses_success_token |
render-emits-ring-command | Rendering emits a ring command | No counterpart on the device side (LoadingProgress is a platform component; for the stroke width see stroke_width_uses_token) |
text-fallback-locale | 加载 label falls back to language pack when unset | loading_text_falls_back_to_pack(Locale.test.ets) |
text-explicit-wins | Explicit 加载 text wins over the pack | loading_text_falls_back_to_pack(Locale.test.ets) |
text-empty-spinner-only | Empty string shows the spinner only | loading_text_empty_means_spinner_only(Locale.test.ets) |
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.

