Default
import { PixelSkeleton } from '@pxlkit/ui-kit';
export function Default() {
return <PixelSkeleton width="12rem" height="1rem" />;
}Animated loading placeholder that reserves layout space while async content resolves.
rounded flips between square/avatar shapes (circle on linear, 2px chamfer on pixel).role="status" and an overridable ariaLabel for screen-reader-friendly loading.import { PixelSkeleton } from '@pxlkit/ui-kit';| Prop | Type | Default | Description |
|---|---|---|---|
width | string | — | CSS width (e.g. "100%", "12rem"). |
height | string | '1rem' | CSS height (default "1rem"). |
rounded | boolean | false | When true, applies a pill/circle radius instead of the surface default. |
surface | 'pixel' | 'linear' | — | Surface override; falls back to nearest provider. |
ariaLabel | string | 'Loading' | Accessible label override; falls back to "Loading". |
Also takes the native attributes and event handlers of <div> (HTMLAttributes<HTMLDivElement>), except role, aria-label.
ref points to <div>.
WCAG target: 2.1 AA
statusRenders with role="status" and a polite implicit live region. Override ariaLabel when the placeholder represents a specific resource (e.g. "Loading user profile") so assistive tech announces what is loading. The pulse plays only for a reader who allows motion: under prefers-reduced-motion: reduce the block holds still, from the server-rendered markup on.
import { PixelSkeleton } from '@pxlkit/ui-kit';
export function Default() {
return <PixelSkeleton width="12rem" height="1rem" />;
}import { PixelSkeleton } from '@pxlkit/ui-kit';
export function Default() {
return <PixelSkeleton width="12rem" height="1rem" />;
}import { PixelSkeleton } from '@pxlkit/ui-kit';
export function TextBlock() {
return (
<div className="flex flex-col gap-2">
<PixelSkeleton width="14rem" height="0.75rem" />
<PixelSkeleton width="11rem" height="0.75rem" />
<PixelSkeleton width="9rem" height="0.75rem" />
</div>
);
}import { PixelSkeleton } from '@pxlkit/ui-kit';
export function Rounded() {
return (
<div className="flex items-center gap-3">
<PixelSkeleton width="2.5rem" height="2.5rem" rounded />
<div className="flex flex-col gap-1.5">
<PixelSkeleton width="8rem" height="0.75rem" />
<PixelSkeleton width="5rem" height="0.75rem" />
</div>
</div>
);
}import { PixelSkeleton } from '@pxlkit/ui-kit';
export function Surfaces() {
return (
<div className="flex flex-col gap-3">
<PixelSkeleton surface="linear" width="14rem" height="1rem" />
<PixelSkeleton surface="pixel" width="14rem" height="1rem" />
</div>
);
}import { PixelSkeleton } from '@pxlkit/ui-kit';
export function CardPlaceholder() {
return (
<div className="flex w-72 flex-col gap-3 rounded border border-retro-border/60 p-4">
<PixelSkeleton width="100%" height="8rem" />
<PixelSkeleton width="80%" height="0.875rem" />
<PixelSkeleton width="60%" height="0.75rem" />
</div>
);
}import { PixelSkeleton } from '@pxlkit/ui-kit';
export function CustomLabel() {
return <PixelSkeleton width="10rem" height="1rem" ariaLabel="Loading user profile" />;
}