Issue 01 · Feedback · p.48
Skeleton loader
Shimmering placeholder that mirrors the shape of the content it stands in for.
Why it works: Match the real layout so nothing jumps when content arrives. The shimmer stops for people who prefer reduced motion.
Try it:
Receipt: axe clean · contrast n/a · 0 tab stops · RTL ✓ · long text ✓
- PASS axe, WCAG 2.1 A and AA: no violations in light or dark (13 rules passed).
- PASS No text to measure for contrast.
- PASS Still passes contrast with tokens fitted to a yellow brand colour.
- PASS Right-to-left with Arabic sample text fits a 390px phone.
- PASS Every string 40% longer still fits a 390px phone.
- PASS Movement stops or calms down with reduced motion on.
Tab order: nothing here takes focus (it is content, not controls).
What assistive tech is given
- status "Loading post"
Automated checks in CI (axe in Chromium, reduced motion on). They catch a lot, not everything: still try it with a screen reader.
See it in the zine npx -y tearsheet add skeleton
Needs the shared tokens.css once per project.
HTML + CSS
index.html
<!-- tearsheet skeleton v5d6312b3 · https://qusaialjbali.github.io/tearsheet/zine/parts/skeleton.html -->
<div class="skeleton-card" role="status" aria-busy="true" aria-label="Loading post">
<div class="skeleton skeleton-avatar"></div>
<div class="skeleton-lines">
<div class="skeleton skeleton-line skeleton-short"></div>
<div class="skeleton skeleton-line"></div>
<div class="skeleton skeleton-line skeleton-medium"></div>
</div>
</div>styles.css
/* tearsheet skeleton v5d6312b3 · https://qusaialjbali.github.io/tearsheet/zine/parts/skeleton.html */
.skeleton-card {
display: flex;
gap: 16px;
width: 100%;
max-width: 420px;
padding: 20px;
background: var(--ui-surface);
border: 1px solid var(--ui-border);
border-radius: var(--ui-radius);
}
.skeleton {
background: linear-gradient(90deg, var(--ui-surface-2) 25%, var(--ui-border) 37%, var(--ui-surface-2) 63%);
background-size: 400% 100%;
animation: shimmer 1.4s ease infinite;
border-radius: 6px;
}
.skeleton-avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; }
.skeleton-lines { display: grid; gap: 10px; flex: 1; align-content: center; }
.skeleton-line { height: 12px; }
.skeleton-short { width: 40%; }
.skeleton-medium { width: 70%; }
@keyframes shimmer {
from { background-position: 100% 50%; }
to { background-position: 0 50%; }
}
@media (prefers-reduced-motion: reduce) {
.skeleton { animation: none; }
}React
Skeleton.jsx
/* tearsheet skeleton v5d6312b3 · https://qusaialjbali.github.io/tearsheet/zine/parts/skeleton.html */
import './Skeleton.css';
export function Skeleton() {
return (
<div className="skeleton-card" role="status" aria-busy="true" aria-label="Loading post">
<div className="skeleton skeleton-avatar"></div>
<div className="skeleton-lines">
<div className="skeleton skeleton-line skeleton-short"></div>
<div className="skeleton skeleton-line"></div>
<div className="skeleton skeleton-line skeleton-medium"></div>
</div>
</div>
);
}Skeleton.css
/* tearsheet skeleton v5d6312b3 · https://qusaialjbali.github.io/tearsheet/zine/parts/skeleton.html */
.skeleton-card {
display: flex;
gap: 16px;
width: 100%;
max-width: 420px;
padding: 20px;
background: var(--ui-surface);
border: 1px solid var(--ui-border);
border-radius: var(--ui-radius);
}
.skeleton {
background: linear-gradient(90deg, var(--ui-surface-2) 25%, var(--ui-border) 37%, var(--ui-surface-2) 63%);
background-size: 400% 100%;
animation: shimmer 1.4s ease infinite;
border-radius: 6px;
}
.skeleton-avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; }
.skeleton-lines { display: grid; gap: 10px; flex: 1; align-content: center; }
.skeleton-line { height: 12px; }
.skeleton-short { width: 40%; }
.skeleton-medium { width: 70%; }
@keyframes shimmer {
from { background-position: 100% 50%; }
to { background-position: 0 50%; }
}
@media (prefers-reduced-motion: reduce) {
.skeleton { animation: none; }
}Vue
Skeleton.vue
<!-- tearsheet skeleton v5d6312b3 · https://qusaialjbali.github.io/tearsheet/zine/parts/skeleton.html -->
<template>
<div class="skeleton-card" role="status" aria-busy="true" aria-label="Loading post">
<div class="skeleton skeleton-avatar"></div>
<div class="skeleton-lines">
<div class="skeleton skeleton-line skeleton-short"></div>
<div class="skeleton skeleton-line"></div>
<div class="skeleton skeleton-line skeleton-medium"></div>
</div>
</div>
</template>
<style scoped>
.skeleton-card {
display: flex;
gap: 16px;
width: 100%;
max-width: 420px;
padding: 20px;
background: var(--ui-surface);
border: 1px solid var(--ui-border);
border-radius: var(--ui-radius);
}
.skeleton {
background: linear-gradient(90deg, var(--ui-surface-2) 25%, var(--ui-border) 37%, var(--ui-surface-2) 63%);
background-size: 400% 100%;
animation: shimmer 1.4s ease infinite;
border-radius: 6px;
}
.skeleton-avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; }
.skeleton-lines { display: grid; gap: 10px; flex: 1; align-content: center; }
.skeleton-line { height: 12px; }
.skeleton-short { width: 40%; }
.skeleton-medium { width: 70%; }
@keyframes shimmer {
from { background-position: 100% 50%; }
to { background-position: 0 50%; }
}
@media (prefers-reduced-motion: reduce) {
.skeleton { animation: none; }
}
</style>Svelte
Skeleton.svelte
<!-- tearsheet skeleton v5d6312b3 · https://qusaialjbali.github.io/tearsheet/zine/parts/skeleton.html -->
<div class="skeleton-card" role="status" aria-busy="true" aria-label="Loading post">
<div class="skeleton skeleton-avatar"></div>
<div class="skeleton-lines">
<div class="skeleton skeleton-line skeleton-short"></div>
<div class="skeleton skeleton-line"></div>
<div class="skeleton skeleton-line skeleton-medium"></div>
</div>
</div>
<style>
.skeleton-card {
display: flex;
gap: 16px;
width: 100%;
max-width: 420px;
padding: 20px;
background: var(--ui-surface);
border: 1px solid var(--ui-border);
border-radius: var(--ui-radius);
}
.skeleton {
background: linear-gradient(90deg, var(--ui-surface-2) 25%, var(--ui-border) 37%, var(--ui-surface-2) 63%);
background-size: 400% 100%;
animation: shimmer 1.4s ease infinite;
border-radius: 6px;
}
.skeleton-avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; }
.skeleton-lines { display: grid; gap: 10px; flex: 1; align-content: center; }
.skeleton-line { height: 12px; }
.skeleton-short { width: 40%; }
.skeleton-medium { width: 70%; }
@keyframes shimmer {
from { background-position: 100% 50%; }
to { background-position: 0 50%; }
}
@media (prefers-reduced-motion: reduce) {
.skeleton { animation: none; }
}
</style>