Skeleton
Introduction
Section titled “Introduction”Decorative loading placeholders: text lines, rectangles, and circles that reserve layout while content loads. Skeletons are hidden from assistive technology. The loading state is communicated by:
Skeleton.markBusy(region, true), which setsaria-busy="true"on the region being loaded;- a visually hidden status inside that region, such as a Spinner with its default hidden label.
Sizes are strictly validated CSS lengths written through the CSSOM.
- Three shapesText lines, rectangles, and circles shaped like the content that is coming.
- Sized to fitLine count, width, and height mirror the final layout to avoid jumps.
- Busy regionsMarks the loading region busy so screen readers wait for the real content.
- Calm animationA gentle pulse that turns off with reduced motion or on request.
Use it for
- Reserving layout for content that is loading, to reduce layout shift.
- Lists, cards, and profile headers whose shape is known in advance.
Use something else for
- As the only loading feedback for assistive technology: pair with a visually hidden status (Spinner).
- Measurable progress: use ProgressBar.
- Content whose shape is unknown.
Anatomy
<div class="aui-skeleton aui-skeleton--text aui-skeleton--pulse" aria-hidden="true"> <span class="aui-skeleton__line"></span> <span class="aui-skeleton__line"></span> <span class="aui-skeleton__line aui-skeleton__line--last"></span> (60% wide)</div>
<div class="aui-skeleton aui-skeleton--rect|circle aui-skeleton--pulse" aria-hidden="true"> <span class="aui-skeleton__block"></span></div>Live example
Section titled “Live example”Use the bar above each frame to switch theme, density, direction, and locale.
Skeleton in the Status center showcase
Section titled “Skeleton in the Status center showcase”The part of the Status center showcase that uses Skeleton. Change its options, use it with the keyboard, and watch the event log; the link in the frame opens the full showcase. The bar above the frame switches theme, density, direction, and locale.
Showcase source
// Feedback showcase: a status center with alerts, inline messages, toasts, a progress bar// driven by a simulated job, spinners, and skeletons while content loads.import { Alert } from '@absoluteui/components/alert';import { Button } from '@absoluteui/components/button';import { InlineMessage } from '@absoluteui/components/inline-message';import { ProgressBar } from '@absoluteui/components/progress-bar';import { Skeleton } from '@absoluteui/components/skeleton';import { Spinner } from '@absoluteui/components/spinner';import { Toaster, toast } from '@absoluteui/components/toast';import { action, choice, createShowcase, hostIn, section, toggle, wait } from './kit.js';
type Tone = 'info' | 'success' | 'warning' | 'error';
const sc = createShowcase({ title: 'Status center', description: 'Alerts, inline messages, toasts, progress, spinners, and skeletons, each with the right live-region behavior.',});
Toaster.create({ position: 'bottom-end', max: 3, duration: 5000 });let tone: Tone = 'info';
const alerts = section(sc, 'Alerts', ['alert']);const alert = Alert.create(hostIn(alerts), { tone: 'warning', title: 'Payroll closes Friday', message: 'Approve all timesheets by Thursday 17:00 to include them in this month.', dismissible: true, actions: [{ label: 'Review timesheets', value: 'review', variant: 'primary' }, { label: 'Remind me later', value: 'later' }],});sc.listen(alert.host, ['aui-action', 'aui-dismiss'], 'alert');
const inline = section(sc, 'Inline messages', ['inline-message']);(['info', 'success', 'warning', 'error'] as const).forEach((t) => InlineMessage.create(hostIn(inline), { tone: t, message: { info: 'Changes are saved automatically.', success: 'Profile updated.', warning: 'Your certificate expires in 12 days.', error: 'The export failed. Try again.' }[t] }),);
const progressSection = section(sc, 'Progress', ['progress-bar']);const bar = ProgressBar.create(hostIn(progressSection), { label: 'Exporting 1,200 records', value: 0, max: 100, showValue: true, announceComplete: true, description: 'You can keep working while the export runs.' });ProgressBar.create(hostIn(progressSection), { label: 'Connecting to the bank', value: null });const spinnerSection = section(sc, 'Spinners', ['spinner']);const spinners = hostIn(spinnerSection);spinners.className = 'sc-row';(['sm', 'md', 'lg'] as const).map((size) => Spinner.create(hostIn(spinners), { size, label: `Loading (${size})`, showLabel: size === 'lg' }));
const loading = section(sc, 'Loading content', ['skeleton']);const card = hostIn(loading);card.className = 'sc-skeleton-card';const skeletons = [Skeleton.create(hostIn(card), { shape: 'circle', width: '3rem', height: '3rem' }), Skeleton.create(hostIn(card), { lines: 3 })];Skeleton.markBusy(card, true);
const toasts = section(sc, 'Toasts', ['toast']);const toastIntro = document.createElement('p');toastIntro.textContent = 'Toasts appear at the bottom end of the page, at most three at a time, and close after five seconds. Choose the tone in the options; Run export ends with a toast that has an action.';toasts.append(toastIntro);const toastRow = hostIn(toasts);toastRow.className = 'sc-row';const showToast = Button.create({ text: 'Show toast', variant: 'secondary' }, document);toastRow.append(showToast.element);
const runExport = async (): Promise<void> => { bar.update({ tone: 'default' }); for (let v = 0; v <= 100; v += 10) { bar.setValue(v); await wait(250); } bar.update({ tone: 'success' }); toast({ tone: 'success', title: 'Export ready', message: 'export-2026-11.csv is ready to download.', action: { label: 'Download', onAction: () => { sc.log('toast action: download'); } } }); sc.log('export finished');};
action( sc, 'Run export', () => { void runExport(); }, ['progress-bar', 'toast'],);showToast.element.addEventListener('click', () => { toast({ tone, message: { info: 'Three people joined your team.', success: 'Settings saved.', warning: 'You are offline. Changes will sync later.', error: 'Could not reach the server.' }[tone] }); sc.log('toast shown', { tone });});action(sc, 'Show alert again', () => { alert.update({ title: 'Payroll closes Friday' }); if (!alert.host.isConnected || alert.host.hidden) alerts.append(alert.host); alert.host.hidden = false;}, ['alert']);choice<Tone>( sc, 'Toast tone', [ { value: 'info', label: 'Info' }, { value: 'success', label: 'Success' }, { value: 'warning', label: 'Warning' }, { value: 'error', label: 'Error' }, ], 'info', (t) => { tone = t; }, ['toast'],);toggle(sc, 'Content loaded', false, (loaded) => { Skeleton.markBusy(card, !loaded); if (loaded) { for (const s of skeletons) s.destroy(); card.textContent = 'Ada Lovelace, Engineering lead. 12 open reviews.'; }}, ['skeleton']);Loading card with busy region and status
Section titled “Loading card with busy region and status”import { Skeleton } from '@absoluteui/components/skeleton';import { Spinner } from '@absoluteui/components/spinner';
const region = document.querySelector<HTMLElement>('#profile');if (region) { const avatarHost = document.createElement('div'); const textHost = document.createElement('div'); const statusHost = document.createElement('div'); region.replaceChildren(statusHost, avatarHost, textHost); Skeleton.markBusy(region, true); const status = Spinner.create(statusHost, { label: 'Loading profile', delay: 300 }); const avatar = Skeleton.create(avatarHost, { shape: 'circle', width: '3rem' }); const text = Skeleton.create(textHost, { lines: 2 }); const done = (): void => { status.destroy(); avatar.destroy(); text.destroy(); Skeleton.markBusy(region, false); }; setTimeout(done, 1000);}Static rectangle
Section titled “Static rectangle”import { Skeleton } from '@absoluteui/components/skeleton';
const host = document.querySelector<HTMLElement>('#chart-placeholder');if (host) { Skeleton.create(host, { shape: 'rect', height: '12rem', animation: 'none' });}Install and start
Section titled “Install and start”npm install @absoluteui/components @absoluteui/core @absoluteui/themeRegistry setup, the theme stylesheet, and the Content Security Policy are covered in Installation.
import { Skeleton } from '@absoluteui/components/skeleton';import '@absoluteui/components/skeleton/style.css';First use
Section titled “First use”import { Skeleton } from '@absoluteui/components/skeleton';import { Spinner } from '@absoluteui/components/spinner';import '@absoluteui/components/skeleton/style.css';import '@absoluteui/components/spinner/style.css';
const region = document.querySelector<HTMLElement>('#profile');if (region) { const statusHost = document.createElement('div'); const avatarHost = document.createElement('div'); region.replaceChildren(statusHost, avatarHost); Skeleton.markBusy(region, true); const status = Spinner.create(statusHost, { label: 'Loading profile', delay: 300 }); const avatar = Skeleton.create(avatarHost, { shape: 'circle', width: '3rem' }); // When loaded: status.destroy(); avatar.destroy(); Skeleton.markBusy(region, false);}More usage
import { Skeleton } from '@absoluteui/components/skeleton';
const host = document.createElement('div');document.body.append(host);Skeleton.create(host, { lines: 2 });Using Angular? See Skeleton for Angular.
API reference
Section titled “API reference”Factory
Section titled “Factory”Skeleton.create(host: HTMLElement, options?: SkeletonOptions): SkeletonGlobal configuration key: skeleton (see Configuration).
Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
shape |
'text' | 'rect' | 'circle' |
"text" |
Placeholder shape. |
lines |
number |
3 |
Text lines (integer 1..100); the last of several lines is 60% wide. |
width |
string | null |
CSS length (px, rem, em, %, ch). null restores the default. | |
height |
string | null |
CSS length (px, rem, em, %, ch); per line for text. null restores the default. | |
animation |
'pulse' | 'none' |
"pulse" |
Pulse animation; always none under reduced motion. Globally configurable. |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
host |
HTMLElement |
The aria-hidden host. |
Methods
Section titled “Methods”| Method | Description |
|---|---|
Skeleton.markBusy(container: HTMLElement, busy: boolean): void |
Set or remove aria-busy=“true” on the loading region. |
update(options: Partial<SkeletonOptions>): void |
Merge and apply options. |
destroy(): void |
Remove placeholders, attributes, custom properties, and subscriptions. |
CSS classes
Section titled “CSS classes”All rules live in the aui.components cascade layer, so application styles override them without specificity battles.
| Class | Purpose |
|---|---|
aui-skeleton |
Host (aria-hidden). |
aui-skeleton--text | --rect | --circle |
Shape modifiers. |
aui-skeleton--pulse | --none |
Animation modifiers. |
aui-skeleton__line |
Text line placeholder. |
aui-skeleton__line--last |
Shorter last line (60%). |
aui-skeleton__block |
Rectangle or circle placeholder. |
Design tokens
Section titled “Design tokens”Tokens this stylesheet reads (verified in CI). Override them in a theme or with the Theme Designer.
--aui-color-active | --aui-color-hover | --aui-easing-standard | --aui-radius-pill | --aui-radius-sm | --aui-space-2
TypeScript definitions
type SkeletonShape = 'text' | 'rect' | 'circle';type SkeletonAnimation = 'pulse' | 'none';interface SkeletonConfig { animation: SkeletonAnimation }interface SkeletonOptions extends Partial<SkeletonConfig> { shape?: SkeletonShape; lines?: number; width?: string | null; height?: string | null;}Accessibility and performance
Section titled “Accessibility and performance”Accessibility
Section titled “Accessibility”Pattern: Decorative placeholders (aria-hidden) inside a region marked aria-busy, with a separate status message.
Checked on every docs build: the showcase passes axe (WCAG 2.2 A and AA rules) in the default, dark, and high-contrast themes and right to left; the playground loads without errors and passes axe before and after every on/off option is switched, with no Content Security Policy violations.
Keyboard
Section titled “Keyboard”| Key | Context | Action |
|---|---|---|
| None | Any | Not focusable; no keyboard interaction. |
| Element | Role |
|---|---|
| host | none (aria-hidden=true) |
ARIA attributes
Section titled “ARIA attributes”| Attribute | Element | Value |
|---|---|---|
aria-hidden |
host | true |
aria-busy |
loading region (Skeleton.markBusy) | “true” while loading; removed when done |
Not focusable. Placeholders never receive focus.
WCAG 2.2 success criteria addressed
Section titled “WCAG 2.2 success criteria addressed”| Criterion | Level | Note |
|---|---|---|
| 1.3.1 Info and Relationships | A | |
| 2.2.2 Pause, Stop, Hide | A | |
| 2.3.3 Animation from Interactions | AAA | |
| 4.1.3 Status Messages | AA |
Automated test results: Accessibility and compliance.
Notes and known caveats
Section titled “Notes and known caveats”- Placeholders are hidden from assistive technology; the region should contain a visually hidden status (for example a Spinner) that announces loading.
- The pulse animation is disabled under prefers-reduced-motion and animation: none.
- aria-busy support varies across screen readers; the status message is the reliable announcement.
Performance
Section titled “Performance”| Import cost | Minified | gzip | brotli | CSS brotli |
|---|---|---|---|---|
@absoluteui/components/skeleton |
7.2 kB | 3.0 kB | 2.6 kB | 0.4 kB |
Measured at build time, including every AbsoluteUI module the component pulls in. No third-party runtime dependencies.
| Budget (enforced in CI) | Limit |
|---|---|
| Skeleton.create() with 100 lines | < 2 ms in headless Chromium |
Tested scale: Up to 100 lines per instance.
No DOM listeners; one configuration subscription. Each render replaces at most lines empty spans. The pulse animates background-color only. Target: under 2 ms per Skeleton.create with 100 lines in headless Chromium (not yet covered by the e2e performance suite).
Measured run times: Performance.
Details
Section titled “Details”States
pulse, and static (animation: 'none', reduced motion, or forced colors).
State transitions
| From | Trigger | To |
|---|---|---|
| pulse | update({ animation: 'none' }) or global config |
static |
| pulse | prefers-reduced-motion: reduce or common animation: 'none' |
static (CSS) |
| any | destroy() |
host restored to empty |
Accessibility notes
- Skeletons carry no information for assistive technology. Put a visually hidden status in the busy region, for example
Spinner.create(statusHost, { label: 'Loading profile' }), so the loading state is announced. aria-busysupport varies across screen readers; the status message is the reliable announcement.- The pulse is disabled under
prefers-reduced-motion: reduceand the commonanimation: 'none'setting.
Responsive behavior
Width defaults to 100% of the container and never exceeds it (max-inline-size: 100%). Line height is em-based, so it scales with the surrounding font size.
Right-to-left
Logical properties throughout. The shorter last line ends at the inline end of its content, like real text.
Theming
Placeholders use color-active and pulse toward color-hover; color-active stays distinct from page and surface backgrounds in every built-in theme. Forced-colors mode uses GrayText without animation.
Global configuration
configureAbsoluteUI({ components: { skeleton: { animation: 'none' } } });Changes apply to existing instances immediately.
Component configuration
Instance options override global and theme defaults. All options are dynamic.
Security
width and height must match ^\d+(\.\d+)?(px|rem|em|%|ch)$. Values such as calc(1px);background:url(x) are rejected before anything is written. Accepted values are applied as custom properties with style.setProperty (CSSOM, CSP-safe); no style attribute strings are generated.
Data handling
No persistence, network access, or telemetry.
Supported data scale
Up to 100 lines per instance. For long lists, render a few skeleton rows rather than one per expected item.
Edge cases
lines: 1renders one full-width line (no shortened last line).- A circle without
heightuses its width as its height. update({ width: null })restores the default width.- Unit-less numbers (
'10'), negative values, exponents, and CSS functions are rejected.
Errors
| Code | Category | Cause |
|---|---|---|
SKELETON_OPTIONS |
configuration | Invalid shape, lines not an integer 1-100, or width/height not a permitted CSS length. |
CFG_INVALID_VALUE / CFG_UNKNOWN_OPTION |
configuration | Invalid or unknown configuration. |
A failed construction leaves the host untouched.
Known limitations
- Only
px,rem,em,%, andchlengths are accepted. - The pulse is a background-color transition, not a moving shimmer gradient.
Unsupported scenarios
- CSS functions (
calc,var,clamp) as sizes. - Wave or shimmer gradients.
(c) 2026 Kasadara Technology Solutions Pvt Ltd. AbsoluteUI is free to use under the AbsoluteUI Free Use License; it is not open source.