feat(kv-components): loading placeholder for text elements AD-411 - #877
Merged
Conversation
Renders a configurable number of shimmer bars sized to the line box of the surrounding type style, so a loading placeholder reserves the space its real text will occupy. Each bar is one cap height tall and sits on the text baseline, and the line height comes from the inherited line-height rather than a fixed pixel guess. AD-411
Adds seven stories and the component docs page built from the standard template. The ComparedWithRealText story puts every type style in the scale beside the text it stands in for, at a fixed width per specimen so the sample wraps to a known number of lines across breakpoints. AD-411
Covers the rendered line count, values below one falling back to a single line, fractional values rounding down, the last line shortening only when there is more than one, and a class passed to the component landing on its root element. AD-411
eddieferrer
approved these changes
Aug 7, 2026
mcstover
approved these changes
Aug 7, 2026
dyersituations
approved these changes
Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a new component, KvLoadingText, that can be used as a loading placeholder for text elements. It renders KvLoadingPlaceholder bars using
display: inline-block; height: 1cap;, which makes the height of the bar match the font size and occupies space that matches the line-height. This means that the placeholder will perfectly match the size of the text it is standing in for as long as it is styled with the same classes, avoiding layout shift when loading completes:See the storybook page for docs and more examples.