Skip to main content Sidebar
On this page

Skeleton

<pc-skeleton> Since  1.0.0-alpha.4 Experimental

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>
Code Edit

Demos

Effects

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.

Edit

Paragraphs

Use multiple skeletons and some CSS styles to simulate paragraphs.

Edit

Avatars

Set a matching width and height to make a circle, square or rounded avatar skeleton.

Edit

Custom shapes

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.

Edit

Colours

Change the --color and --sheen-color custom properties to adjust the colours of the skeleton.

Edit

Properties

NameDescriptionReflectsDefault
effectDetermines the effect the skeleton will use.
Type: "pulse" | "sheen" | "none"
"none"
updateComplete A read‐only promise that resolves when the component has finished updating.

Learn more about customising animations.

Custom properties

NameDescriptionDefault
--colorThe colour of the skeleton.var(--pc-color-neutral-fill-normal)
--sheen-colorThe sheen colour of the skeleton.color-mix(in oklab, var(--color), var(--pc-color-surface-raised) 40%)

Learn more about customising custom properties.

Parts

NameDescription
indicatorThe skeleton’s indicator.

Learn more about customising CSS parts.

Importing

If you’re using the autoloader or the standard loader, you can skip this section. But if you’re cherry picking, you can use any of the following snippets to import this component.

CDN (script tag)CDN (import)npm (import)

To manually import this component from the CDN, copy this code snippet and paste it in your HTML.

<script type="module" src="https://cdn.jsdelivr.net/npm/placer-toolkit@1.0.0-alpha.4/cdn/components/skeleton/skeleton.js"></script>

To manually import this component from the CDN, copy this code snippet and paste it in your JavaScript file.

import "https://cdn.jsdelivr.net/npm/placer-toolkit@1.0.0-alpha.4/cdn/components/skeleton/skeleton.js";

To manually import this component from npm, copy this code snippet and paste it in your JavaScript file.

import "placer-toolkit/dist/components/skeleton/skeleton.js";

We’d love to hear from you. Please reach out to us with any questions or enquiries you may have.

You can contact us via e‐mail at placer.coc.reports+contact@gmail.com.

We look forward to hearing from you!

Got it!
Dangerous lands

Whoa! You’ve wandered into the dangerous lands of Placer Toolkit. Version 0 is out of date and doesn’t meet EU privacy standards, including GDPR.

Want the latest powers, security and compliance? Stick with the current version of Placer Toolkit!

Yikes! Power up!

Our site is 100 % cookie‐free! We value your privacy, which is why we don’t store any cookies or personal information related to you.

Your browser history is safe from crumbs, and your data is protected, aligning with modern privacy standards like the GDPR. Enjoy your visit without a single digital cookie in sight! 🍪🚫

View our Privacy Policy for more information.

Got it!