Loading
A loading indicator with a spinning ring animation. The duration comes from motion.duration.base (in milliseconds).
Spec source:
lh-ui-core/specs/loading.json· Golden cases:cases/loading.json(8 cases: 5 token mappings translated into JVM unit tests, 3 label semantics asserted in androidTest)
Size and tone
Three sizes map to the loading.size.* tokens, the stroke width comes from loading.strokeWidth, and tones take semantic colors.
Loading…
HTML mock preview (Android / Compose look), not an on-device render
kotlin
LhLoading(lhSize = LhLoadingSize.large, tone = LhLoadingTone.primary)Loading label
text falls back to the locale pack when omitted (default "Loading…"); an explicit label takes precedence; an empty string renders the spinner only.
kotlin
LhLoading(text = "Syncing")API
Props
| Prop | Description | Type | Default |
|---|---|---|---|
lhSize | Indicator diameter | LhLoadingSize | Medium |
tone | Ring color | LhLoadingTone | Primary |
text | Loading label; falls back to the locale pack when omitted, empty string renders the spinner only | String? | @lh-i18n |
modifier | Modifier | Modifier | Modifier |
LhLoadingSize
| Value | Size token |
|---|---|
Small | loading.size.small (16dp) |
Medium | loading.size.medium (20dp) |
Large | loading.size.large (24dp) |
LhLoadingTone
| Value | Color token |
|---|---|
Primary | color.primary.default |
Success | color.success.default |
Warning | color.warning.default |
Danger | color.danger.default |
Info | color.info.default |
Token reference
| Token | Usage |
|---|---|
loading.size.{small,medium,large} | Three diameters |
loading.strokeWidth | Ring stroke width |
typography.fontSize.small / color.text.secondary | Label font size and color |
color.{primary,success,warning,danger,info}.default | Semantic tones |
motion.duration.base | Duration of one full rotation (an integer number of milliseconds on the client) |
Golden case reference
| case id | Assertion | Local test |
|---|---|---|
medium-size-uses-medium-token | Medium takes the medium size token | LhLoadingDefaultsTest.medium_size_uses_medium_token |
large-size-uses-large-token | Large takes the large size token | LhLoadingDefaultsTest.large_size_uses_large_token |
primary-tone-uses-primary-token | The primary tone takes the primary token | LhLoadingDefaultsTest.primary_tone_uses_primary_token |
success-tone-uses-success-token | The success tone takes the success token | LhLoadingDefaultsTest.success_tone_uses_success_token |
render-emits-ring-command | The ring indicator renders (the stroke width consumes a token) | LhLoadingDefaultsTest.stroke_width_uses_token |
text-fallback-locale | An omitted label falls back to the locale pack (default "Loading…") | LhLoadingTest.text_fallback_to_locale |
text-explicit-wins | An explicit label takes precedence over the locale pack | LhLoadingTest.explicit_text_wins_over_locale |
text-empty-spinner-only | An empty string renders the spinner only | LhLoadingTest.empty_text_renders_spinner_only |
bash
./gradlew :components:loading:test # JVM part (token mappings)
./gradlew :components:loading:connectedAndroidTest # Instrumented part (label semantics; requires a device)
