Configurator
<oc-skeleton-v1 variant="rectangle" width="320px" height="48px"></oc-skeleton-v1>Usage
Variants
The skeleton can be customized in its shape, dimensions, and border radius to match the associated content. Choose the width and height dimensions and the border radius according to the element it stands for. It has the following shape variants:
- Rectangle
- Rounded rectangle
- Circle
The shapes are freely scalable, whereby the circle has a fixed aspect ratio of 1:1.
HTML
<div class="on-frame" style="margin:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px">
<div style="background:var(--oc-semantic-color-background-canvas, #fff);padding:24px 16px;display:grid;place-items:center;justify-items:stretch"><oc-skeleton-v1 width="100%" height="36px" border-radius="0px"></oc-skeleton-v1></div>
<div style="background:var(--oc-semantic-color-background-canvas, #fff);padding:24px 16px;display:grid;place-items:center;justify-items:stretch"><oc-skeleton-v1 width="100%" height="36px"></oc-skeleton-v1></div>
<div style="background:var(--oc-semantic-color-background-canvas, #fff);padding:24px 16px;display:grid;place-items:center"><oc-skeleton-v1 variant="circle" width="64px"></oc-skeleton-v1></div>
Behavior
States
The skeleton only has a default loading state.
No interactive states: the skeleton only shows that content is loading
HTML
<oc-skeleton-v1 width="100%" height="36px" border-radius="0px"></oc-skeleton-v1></div>
<p class="demo-label" style="text-align:center">No interactive states: the skeleton only shows that content is loading</p>Animation
The skeleton has a wave animation that is implemented with a gradient. The gradient moves across the skeleton once for 350ms. It starts on the left and moves linearly to the right. After pausing for 500ms, the animation starts again. Once the content has loaded, the skeleton disappears and the actual content is displayed. This is accompanied by a 50ms linear fade-in.
Loading: the shimmer loops
Loading complete: content fades in
HTML
<div class="on-frame" style="margin:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px">
<div style="background:var(--oc-semantic-color-background-canvas, #fff);padding:24px 16px;display:grid;place-items:center;justify-items:stretch"><p class="demo-label" style="margin-bottom:8px">Loading: the shimmer loops</p><oc-skeleton-v1 width="100%" height="32px" border-radius="8px"></oc-skeleton-v1></div>
<div style="background:var(--oc-semantic-color-background-canvas, #fff);padding:24px 16px;display:grid;place-items:center"><p class="demo-label" style="margin-bottom:8px">Loading complete: content fades in</p><oc-button-v1 variant="primary">In den Warenkorb</oc-button-v1></div>
Fitting
Make sure the skeleton matches the rough shape of the content it replaces.
HTML
<div class="on-frame" style="margin:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px">
<div style="background:var(--oc-semantic-color-background-canvas, #fff);padding:24px 16px;display:grid;place-items:center"><div style="display:flex;flex-direction:column;gap:4px;width:160px"><div style="position:relative;background:var(--oc-semantic-color-background-soft-blue, #cfe3f7);border-radius:24px;width:160px;height:214px"><oc-tag-v1 variant="info-primary" size="50" style="position:absolute;left:16px;bottom:16px">Sehr beliebt</oc-tag-v1></div><span class="demo-copy" style="text-transform:uppercase;margin-top:8px">OTTO products</span><span class="demo-copy">Bettwäsche aus Bio-Baumwolle</span><strong style="color:var(--oc-semantic-color-text-sale, #e20020);margin-top:8px">€ 39,99</strong></div></div>
<div style="background:var(--oc-semantic-color-background-canvas, #fff);padding:24px 16px;display:grid;place-items:center"><div style="display:flex;flex-direction:column;gap:10px;width:160px"><oc-skeleton-v1 width="160px" height="214px" border-radius="24px"></oc-skeleton-v1><oc-skeleton-v1 width="160px" height="48px" border-radius="4px"></oc-skeleton-v1><oc-skeleton-v1 width="160px" height="24px" border-radius="4px"></oc-skeleton-v1></div></div>
Placement
Place the skeleton in the same location as the content it replaces.
HTML
<div class="on-frame" style="margin:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px">
<div style="background:var(--oc-semantic-color-background-canvas, #fff);padding:24px 16px;display:grid;place-items:center"><div style="display:grid;grid-template-columns:1fr 1fr;gap:8px;width:100%"><oc-button-v1 variant="secondary">Merken</oc-button-v1><oc-button-v1 variant="primary">Kaufen</oc-button-v1></div></div>
<div style="background:var(--oc-semantic-color-background-canvas, #fff);padding:24px 16px;display:grid;place-items:center"><div style="display:grid;grid-template-columns:1fr 1fr;gap:8px;width:100%"><oc-skeleton-v1 width="100%" height="48px" border-radius="8px"></oc-skeleton-v1><oc-skeleton-v1 width="100%" height="48px" border-radius="8px"></oc-skeleton-v1></div></div>
Place skeletons on top of the frame (level 0), inside the canvas (level 1) or on top of the canvas (level 1.5).
HTML
<div class="on-frame" style="margin:0;display:grid;grid-template-columns:1fr auto 1fr;gap:24px;align-items:center;padding:24px 16px">
<oc-skeleton-v1 width="100%" height="36px" border-radius="0px"></oc-skeleton-v1>
<div style="background:var(--oc-semantic-color-background-canvas, #fff);padding:24px;width:200px"><oc-skeleton-v1 width="100%" height="36px" border-radius="0px"></oc-skeleton-v1></div>
<oc-skeleton-v1 width="100%" height="36px" border-radius="0px"></oc-skeleton-v1>
Skeleton vs. spinner
Use the skeleton if you want to give a preview of loading content and to avoid unexpected shifts in the layout (CLS). In contrast to this use the spinner if a process is happening asynchronously and no preview is possible, such as submitting a form.
Skeleton: content is loading
Spinner: an action is running
HTML
<p class="demo-label">Skeleton: content is loading</p><oc-skeleton-v1 width="100%" height="128px" border-radius="0px"></oc-skeleton-v1></div>
<p class="demo-label">Spinner: an action is running</p><oc-auth-field-v1><input type="password" id="skeleton-vs-spinner-pw" value="geheim"><label for="skeleton-vs-spinner-pw">Passwort</label></oc-auth-field-v1><oc-button-v1 variant="secondary" loading>Daten werden übermittelt</oc-button-v1></div>
Best practices
Hover the button: the tooltip appears only on demand, so it never needs a skeleton
Accessibility
For information on accessibility, refer to the technical documentation.
Status
Related components
Implementation
Live demo
Das könnte dir auch gefallen
andas
Sessel „Ilvy“ aus Bouclé, Eiche natur
399,99 €
The first tile has loaded; the other two keep their place with skeletons of the same shape
HTML
<p class="demo-title" style="font-size:1.25rem">Das könnte dir auch gefallen</p>
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(9.5rem,1fr));gap:24px 16px"><article style="display:flex;flex-direction:column;gap:2px;min-width:0"><div style="position:relative;border-radius:16px;overflow:hidden;background:#f3f3f3"><img src="/previews/imagery/samples/otto-product-still/product-armchair.webp" alt="Sessel „Ilvy“ aus Bouclé, Eiche natur" width="600" height="600" loading="lazy" style="display:block;width:100%;height:auto;margin:0;mix-blend-mode:multiply"><div style="position:absolute;left:12px;bottom:12px;display:flex;gap:4px;flex-wrap:wrap"><oc-tag-v1 variant="info-primary" size="50">Neu</oc-tag-v1></div></div><p class="demo-copy" style="margin-top:10px;color:var(--oc-semantic-color-text-secondary, #6d6d6d);text-transform:uppercase;font-size:0.75rem;letter-spacing:0.02em">andas</p><p class="demo-copy">Sessel „Ilvy“ aus Bouclé, Eiche natur</p><p class="demo-copy" style="margin-top:6px"><strong style="font-size:1rem">399,99 €</strong></p></article><article style="display:flex;flex-direction:column;gap:8px;min-width:0"><div style="aspect-ratio:1/1"><oc-skeleton-v1 width="100%" height="100%" border-radius="16px" style="display:block;height:100%"></oc-skeleton-v1></div><oc-skeleton-v1 width="40%" height="12px" border-radius="4px"></oc-skeleton-v1><oc-skeleton-v1 width="100%" height="40px" border-radius="4px"></oc-skeleton-v1><oc-skeleton-v1 width="35%" height="20px" border-radius="4px"></oc-skeleton-v1></article><article style="display:flex;flex-direction:column;gap:8px;min-width:0"><div style="aspect-ratio:1/1"><oc-skeleton-v1 width="100%" height="100%" border-radius="16px" style="display:block;height:100%"></oc-skeleton-v1></div><oc-skeleton-v1 width="40%" height="12px" border-radius="4px"></oc-skeleton-v1><oc-skeleton-v1 width="100%" height="40px" border-radius="4px"></oc-skeleton-v1><oc-skeleton-v1 width="35%" height="20px" border-radius="4px"></oc-skeleton-v1></article></div>
