Feedback
Skeleton
Free11.5 KB gzippedA soft, rounded placeholder shown while content loads.
Accessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · No keyboard interaction of its own · Full report
Import
import {
Skeleton,
SkeletonText,
SkeletonAvatar,
SkeletonCircle,
SkeletonGroup,
} from "@vjdesigns/vjdesigns-ui";
Importing only Skeleton adds about 11.5 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.
Examples
Shapes
Placeholders shaped like the content they stand in for.
import {
Card,
Flex,
Skeleton,
SkeletonAvatar,
SkeletonText,
Stack,
} from "@vjdesigns/vjdesigns-ui";
export function Shapes() {
return (
<Card variant="outline" style={{ width: "100%", maxWidth: "24rem" }}>
<Flex gap={3} align="center">
<SkeletonAvatar size="lg" />
<Stack gap={2} style={{ flex: 1 }}>
<Skeleton variant="text" width="60%" />
<Skeleton variant="text" width="40%" />
</Stack>
</Flex>
<Skeleton height={140} radius="lg" />
<SkeletonText lines={3} />
</Card>
);
}
Loading to content
SkeletonGroup announces "Loading…" once for the whole region (not per shape), and Skeleton with children swaps to the real content when loading turns off.
import { useState } from "react";
import {
Avatar,
Button,
Card,
Flex,
Skeleton,
SkeletonGroup,
Stack,
Text,
} from "@vjdesigns/vjdesigns-ui";
export function LoadingToContent() {
const [loading, setLoading] = useState(true);
return (
<Stack gap={4} align="center" style={{ width: "100%", maxWidth: "24rem" }}>
<Card variant="outline" style={{ width: "100%" }}>
<SkeletonGroup loading={loading} label="Loading profile">
<Flex gap={3} align="center">
<Skeleton variant="circle" loading={loading}>
<Avatar name="Jordan Lee" colorFromName size="lg" />
</Skeleton>
<Stack gap={1}>
<Skeleton loading={loading} variant="text">
<Text weight="semibold">Jordan Lee</Text>
</Skeleton>
<Skeleton loading={loading} variant="text">
<Text size="sm" tone="muted">
Product designer · Seattle
</Text>
</Skeleton>
</Stack>
</Flex>
</SkeletonGroup>
</Card>
<Button variant="outline" tone="neutral" onClick={() => setLoading((l) => !l)}>
{loading ? "Finish loading" : "Reload"}
</Button>
</Stack>
);
}
Accessibility
While loading, SkeletonGroup marks the region aria-busy and announces its label once, and the hidden content underneath is inert and aria-hidden, so nothing half-loaded is read or focused. loadedLabel announces when it's ready.
import { useState } from "react";
import {
Avatar,
Button,
Flex,
SkeletonAvatar,
SkeletonGroup,
SkeletonText,
Stack,
Text,
} from "@vjdesigns/vjdesigns-ui";
export function Accessibility() {
const [loading, setLoading] = useState(true);
return (
<Stack gap={4} style={{ width: "100%", maxWidth: "24rem" }}>
<Button variant="outline" tone="neutral" onClick={() => setLoading((l) => !l)}>
{loading ? "Finish loading" : "Load again"}
</Button>
<SkeletonGroup loading={loading} label="Loading profile" loadedLabel="Profile loaded">
<Flex gap={3} align="center">
{loading ? <SkeletonAvatar /> : <Avatar name="Ana Ruiz" />}
<Stack gap={1} style={{ flex: 1 }}>
{loading ? <SkeletonText lines={2} /> : <Text weight="semibold">Ana Ruiz · Product lead</Text>}
</Stack>
</Flex>
</SkeletonGroup>
</Stack>
);
}
Translated
Without a label, the loading and loaded announcements come from the locale (Spanish here).
import {
Card,
SkeletonGroup,
SkeletonText,
LocaleProvider,
} from "@vjdesigns/vjdesigns-ui";
import es from "@vjdesigns/vjdesigns-ui/locales/es";
export function Translated() {
return (
<LocaleProvider locale="es" messages={es}>
<SkeletonGroup loading>
<Card padding="md" style={{ width: "100%", maxWidth: "24rem" }}>
<SkeletonText lines={3} />
</Card>
</SkeletonGroup>
</LocaleProvider>
);
}
Right to left
The first example again, inside a right-to-left LocaleProvider (Arabic). Layout, spacing and arrow icons mirror, and the components' built-in text is translated. The example's own text stays in English.
Shapes
import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";
// Shapes is the "Shapes" example above.
<LocaleProvider locale="ar" messages={ar}>
<Shapes />
</LocaleProvider>
Usage notes
Use it two ways:
- Placeholder:
<Skeleton variant="text" />, sized withwidthandheight. Renders a decorativespan(aria-hidden). - Wrapper:
<Skeleton loading={isLoading}>{content}</Skeleton>. The content is laid out invisibly under the fill, so the page doesn't shift when it loads. Whenloadingturnsfalse, the same wrapper shows the content.
Accessibility:
- Placeholders are hidden from assistive technology. While loading, wrapped content is
inertand hidden, so it can't be focused or read. - Many placeholders shouldn't announce many times: wrap the loading region in one
SkeletonGroup(or passloadingLabelto a single wrapper), which marks the regionaria-busyand announces "Loading…" once.
API reference
Skeleton
| Prop | Type | Default |
|---|---|---|
variantPlaceholder shape. Ignored in wrapper mode, except that | "rect""text""circle""pill" | "rect" |
widthWidth as a CSS length (numbers are px). Defaults depend on | SkeletonLength | — |
heightHeight as a CSS length (numbers are px). Defaults depend on | SkeletonLength | — |
radiusCorner rounding. Overrides the variant's default ( | "none""xs""sm""md""lg""xl""2xl""pill" | — |
animationLoading motion. Stops under | "pulse""shimmer""none" | "pulse" |
loadingWrapper mode only (when | boolean | true |
inlineWrapper mode only: render the wrapper as | boolean | false |
loadingLabelWrapper mode only: when set, the wrapper also announces this text once through a polite | string | — |
loadedLabelWrapper mode only: text announced once loading finishes (e.g. "Profile loaded"). Needs | string | — |
childrenReal content. When given, | ReactNode | — |
refThe root element: a | Ref<HTMLElement> | — |
Also accepts native <span> attributes, plus className, style and ref.
SkeletonText
Lines of placeholder text, sized like real Text or Heading content so nothing jumps when the text arrives. The last line is shorter. Decorative (aria-hidden).
| Prop | Type | Default |
|---|---|---|
linesNumber of lines. | number | 3 |
lastLineWidthWidth of the last line, as a CSS length (numbers are px). Ignored for a single line unless set. | SkeletonLength | "60%" |
widthWidth of the whole block (numbers are px). | SkeletonLength | "100%" |
sizeFont size of the text this stands in for, matching Typography's | "xs""sm""md""lg""xl""2xl""3xl""4xl""5xl""6xl" | "md" |
leadingLine height, matching Typography's | "tight""snug""normal""relaxed" | "normal" |
gapExtra space between lines (a | Space | 0 |
animationLoading motion. | "pulse""shimmer""none" | "pulse" |
Also accepts native <span> attributes, plus className, style and ref.
SkeletonAvatar
A placeholder the exact size and shape of an Avatar. Decorative (aria-hidden).
| Prop | Type | Default |
|---|---|---|
sizeMatches | "xs""sm""md""lg""xl""2xl" | "md" |
shapeMatches | "circle""rounded""square" | "circle" |
animationLoading motion. | "pulse""shimmer""none" | "pulse" |
Also accepts native <span> attributes, plus className, style and ref.
SkeletonCircle
A circular placeholder in Avatar sizes (SkeletonAvatar with shape="circle").
| Prop | Type | Default |
|---|---|---|
sizeMatches | "xs""sm""md""lg""xl""2xl" | "md" |
animationLoading motion. | "pulse""shimmer""none" | "pulse" |
Also accepts standard HTML attributes, plus className, style and ref.
SkeletonGroup
Wraps a loading region so screen readers get one announcement instead of one per placeholder. The region carries aria-busy while loading; a visually hidden polite role="status" beside it says label once. Put the real content inside the same group, so aria-busy clears on the region that holds it.
| Prop | Type | Default |
|---|---|---|
loadingWhether the region is loading. While | boolean | true |
labelText announced politely when loading starts. Localize it here. | string | "Loading…" |
loadedLabelText announced when loading finishes (e.g. "Results loaded"). Nothing is announced by default. | string | — |
childrenThe placeholders while loading, then the real content. | ReactNode | — |
Also accepts native <div> attributes, plus className, style and ref.
See what changed in each version in the Changelog.
Accessibility report
Skeleton targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.
axe-core audit (live)
Checking the examples above…
Lighthouse audit
Light mode
Score 10035 passed · 0 failed · 30 not applicable · 10 to check by hand
Dark mode
Score 10035 passed · 0 failed · 30 not applicable · 10 to check by hand
Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.
Built-in behavior
Keyboard
Not focusable, so there's no keyboard interaction of its own.
Roles and states
| Element | Role | States and properties |
|---|---|---|
| Placeholder shapes | none | aria-hidden="true" |
| Loading container | none (generic) | aria-busy while loading |
| Live region | status | Announces loading and loaded |
Manual checks
Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.
| Check | What to test | WCAG 2.2 |
|---|---|---|
| Keyboard | Every action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck. | 2.1.1 (A), 2.1.2 (A) |
| Focus | Focus moves in a logical order, is always visible, and isn't hidden behind sticky headers. | 2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA) |
| Screen readers | Names, roles and states are announced correctly, and status changes are announced without moving focus. | 1.3.1 (A), 4.1.2 (A), 4.1.3 (AA) |
| Color | Meaning never depends on color alone; your own colors meet contrast in both modes. | 1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA) |
| Zoom and reflow | At 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed. | 1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA) |
| Pointer targets | Click and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap. | 2.5.8 (AA), 2.5.5 (AAA) |
| Motion | Animations respect the reduced-motion setting. | 2.3.3 (AAA) |