Skeleton
<pc-skeleton> Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Skeletons are used to provide a visual representation of where content will eventually be shown.
These are simple containers for scaffolding layouts that mimic what users will see when content has finished loading. This prevents large areas of empty space during asynchronous operations.
This component is trying to not be opinionated, as there are endless possibilities for designing layouts. Therefore, you’ll likely use more than one skeleton to create the effect you want. If you find yourself using them frequently, consider creating a template that renders them with the desired arrangement and styles.
<div class="skeleton-overview">
<header>
<pc-skeleton effect="sheen"></pc-skeleton>
<pc-skeleton effect="sheen"></pc-skeleton>
</header>
<pc-skeleton effect="sheen"></pc-skeleton>
<pc-skeleton effect="sheen"></pc-skeleton>
<pc-skeleton effect="sheen"></pc-skeleton>
</div>
<style>
.skeleton-overview header {
display: flex;
align-items: center;
margin-block-end: var(--pc-spacing-m);
}
.skeleton-overview header pc-skeleton:first-child {
float: left;
margin-inline-end: var(--pc-spacing-l);
inline-size: 3rem;
block-size: 3rem;
vertical-align: middle;
}
.skeleton-overview header pc-skeleton:last-child {
flex: 0 0 auto;
inline-size: 30%;
}
.skeleton-overview pc-skeleton {
margin-block-end: var(--pc-spacing-l);
}
.skeleton-overview pc-skeleton:nth-child(3) {
inline-size: 95%;
}
.skeleton-overview pc-skeleton:nth-child(4) {
inline-size: 80%;
}
</style> There are two built‐in effects, sheen and pulse. The effects are intentionally subtle, as they can be distracting when used extensively. The default is none which displays a static non‐animated skeleton.
Use multiple skeletons and some CSS styles to simulate paragraphs.
Set a matching width and height to make a circle, square or rounded avatar skeleton.
Set a border-radius on the indicator part to make circles, squares and rectangles. For more complex shapes, you can apply clip-path to the indicator part.
Change the --color and --sheen-color custom properties to adjust the colours of the skeleton.
| Name | Beschreibung | Reflektiert | Standard |
|---|---|---|---|
effect | Determines the effect the skeleton will use. Typ: "pulse" | "sheen" | "none" |
| "none" |
updateComplete | Ein schreibgeschütztes Promise, das erfüllt ist, sobald die Komponente fertig aktualisiert wurde. | ‐ |
Erfahre mehr über Attribute und Eigenschaften.
| Name | Beschreibung | Standard |
|---|---|---|
--color | The colour of the skeleton. | var(--pc-color-neutral-fill-normal) |
--sheen-color | The sheen colour of the skeleton. | color-mix(in oklab, var(--color), var(--pc-color-surface-raised) 40%) |
Erfahre mehr über das Anpassen von benutzerdefinierten Eigenschaften.
| Name | Beschreibung |
|---|---|
indicator | The skeleton’s indicator. |
Erfahre mehr über das Anpassen von CSS‐Parts.
Wenn du den Autoloader oder den Standard‐Loader nutzt, kannst du diesen Abschnitt überspringen. Falls du „Cherry Picking“ betreibst, kannst du die folgenden Snippets verwenden, um diese Komponente zu importieren.
Um diese Komponente manuell vom CDN zu importieren, kannst du dieses Code‐Snippet kopieren und es in dein HTML einfügen.
<script type="module" src="https://cdn.jsdelivr.net/npm/placer-toolkit@1.0.0-alpha.4/cdn/components/skeleton/skeleton.js"></script> Um diese Komponente manuell vom CDN zu importieren, kannst du dieses Code‐Snippet kopieren und es in deine JavaScript‐Datei einfügen.
import "https://cdn.jsdelivr.net/npm/placer-toolkit@1.0.0-alpha.4/cdn/components/skeleton/skeleton.js"; Um diese Komponente manuell von npm zu importieren, kannst du dieses Code‐Snippet kopieren und es in deine JavaScript‐Datei einfügen.
import "placer-toolkit/dist/components/skeleton/skeleton.js";