Skip to content

feat(loading-spinner): support loading text below spinner#1957

Open
chintankavathia wants to merge 1 commit intomainfrom
feat/loading-spinner/loading-text
Open

feat(loading-spinner): support loading text below spinner#1957
chintankavathia wants to merge 1 commit intomainfrom
feat/loading-spinner/loading-text

Conversation

@chintankavathia
Copy link
Copy Markdown
Member

@chintankavathia chintankavathia commented Apr 27, 2026

Summary

Adds a loadingText input to SiLoadingSpinnerDirective and SiLoadingSpinnerComponent that displays an optional translatable text label below the spinner animation.

Motivation

Our Loading pattern already documents and visually shows a spinner with accompanying text, and the best practices explicitly recommend:

"Consider complementing the loading indicators with a brief text for context."

However, until now there was no built-in way to render that text — consumers had to implement custom overlays or workarounds to achieve what the pattern already prescribes. This gap between documented guidance and available API caused inconsistent implementations across teams.

What's included

  • New loadingText input on both the directive ([siLoading]) and the component (si-loading-spinner), accepting a TranslatableString for i18n support.
  • Layout adjustment — the spinner container switches to flex-direction: column so text renders centered below the SVG.
  • Runtime reactivity — changing loadingText while the spinner is active updates the displayed text immediately via setInput.
  • Unit test verifying text is rendered in the DOM when provided.
  • Live example (si-loading-spinner-text) demonstrating a realistic full-page loading state with contextual text ("Loading Dashboard…").

Usage

<div [siLoading]="isLoading" loadingText="Loading Dashboard...">
  <!-- content -->
</div>

Documentation.
Examples.
Dashboards Demo.
Playwright report.

Coverage Reports:

Code Coverage

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an optional loadingText input to the SiLoadingSpinnerComponent and SiLoadingSpinnerDirective, allowing translatable text to be displayed below the spinner. The changes include styling updates to support a vertical layout, logic to pass the text through the directive's portal, and a new example page. Review feedback focused on aligning user-facing strings in tests and examples with UX writing guidelines, specifically regarding the use of the ellipsis character, sentence casing, and avoiding polite fillers like "please".

Comment thread projects/element-ng/loading-spinner/si-loading-spinner.directive.spec.ts Outdated
Comment thread projects/element-ng/loading-spinner/si-loading-spinner.directive.spec.ts Outdated
Comment thread src/app/examples/si-loading-spinner/si-loading-spinner-text.html Outdated
@chintankavathia chintankavathia force-pushed the feat/loading-spinner/loading-text branch from 8e6aaad to 94a1146 Compare April 27, 2026 06:23
@chintankavathia
Copy link
Copy Markdown
Member Author

@chintankavathia chintankavathia marked this pull request as ready for review April 27, 2026 06:43
@chintankavathia chintankavathia requested review from a team as code owners April 27, 2026 06:43
@spike-rabbit spike-rabbit requested a review from panch1739 April 27, 2026 07:36
Copy link
Copy Markdown
Member

@spliffone spliffone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we adjust the the existing si-loading-spinner and si-loading-spinner-directive examples instead of a new example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants