Skip to content

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.

9:41Loading sizes

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

typescript
LhLoading({ size: LhLoadingSize.Large })

Tones ​

tone decides the ring color, mapping one-to-one onto the semantic color tokens.

9:41Loading tones

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

API ​

Props ​

PropDescriptionTypeDefault
sizeIndicator diameter, maps to the loading.size tokensLhLoadingSizeMedium
toneRing color, takes the matching semantic color tokenLhLoadingTonePrimary
textLoading label; falls back to language pack when unset; empty string hides the labelstringLanguage pack (@lh-i18n)

LhLoadingSize ​

Valuesize
Smallloading.size.small (16vp)
Mediumloading.size.medium (20vp)
Largeloading.size.large (24vp)

LhLoadingTone ​

ValueRing color
Primarycolor.primary.default
Successcolor.success.default
Warningcolor.warning.default
Dangercolor.danger.default
Infocolor.info.default

Token reference ​

TokenPurpose
loading.size.{small,medium,large}Three diameters
loading.strokeWidthRing stroke width (2vp)
color.{primary,success,warning,danger,info}.defaultFive ring colors

Golden case reference ​

How the 8 assertions in cases/loading.json map onto hypium tests (entry/src/test/Loading.test.ets):

case idAssertionLocal test
medium-size-uses-medium-tokenMedium takes the medium size tokenmedium_size_uses_medium_token
large-size-uses-large-tokenLarge takes the large size tokenlarge_size_uses_large_token
primary-tone-uses-primary-tokenThe primary tone takes the primary color tokenprimary_tone_uses_primary_token
success-tone-uses-success-tokenThe success tone takes the success color tokensuccess_tone_uses_success_token
render-emits-ring-commandRendering emits a ring commandNo 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 unsetloading_text_falls_back_to_pack(Locale.test.ets)
text-explicit-winsExplicit 加载 text wins over the packloading_text_falls_back_to_pack(Locale.test.ets)
text-empty-spinner-onlyEmpty string shows the spinner onlyloading_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.

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