Skeleton
Importing
Add rh-skeleton to your page with this import statement:
<script type="module">
import '@rhds/elements/rh-skeleton/rh-skeleton.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
To learn more about installing RHDS elements on your site using an import map read our getting started docs.
Lightdom CSS
This element requires you to load "Lightdom CSS" stylesheets for styling deeply slotted elements.
Note
Replace /path/to/ with path to the CSS file, whether local or CDN.
<link rel="stylesheet" href="/path/to/rh-skeleton/rh-skeleton-lightdom.css">
Usage
<rh-skeleton></rh-skeleton>
<link rel="stylesheet" href="../rh-skeleton-lightdom.css">
<script type="module">
import '@rhds/elements/rh-skeleton/rh-skeleton.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
Users should remove <rh-skeleton> elements from the DOM once content is loaded. See the Accessibility for more information.
rh-skeleton
A skeleton provides an animated placeholder for content that is loading progressively. Must not receive focus or keyboard input.
Slots
1
| Slot Name | Summary | Description |
|---|---|---|
[default]
|
Visually hidden text for screen readers.
Customize by slotting in text that describes the loading content.
Accepts inline text content. Defaults to "Loading...".
Should be customized when multiple skeletons appear on the same page
to help users of assistive technologies distinguish between them. |
Attributes
2
| Attribute | DOM Property | Description | Type | Default |
|---|---|---|---|---|
type
|
type |
What shape the skeleton should be. Defaults to |
|
|
size
|
size |
What size the skeleton should be. Defaults to |
|
|
Methods
0
None
Events
0
None
CSS Shadow Parts
0
None
CSS Custom Properties
0
None
Design Tokens
1
| Token | Description | Copy |
|---|---|---|
--rh-length-4xs
|
Minimum dimension for visually hidden content Minimum dimension for visually hidden content 1px length token |
|
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.