Skeleton
Skeleton shows a stable loading placeholder that matches the future content shape.
@duskmoon-dev/components/skeleton Usage
When to use
- Use it to clarify state, metadata, content hierarchy, or loading without creating a new workflow.
- Pair it with semantic content so visual treatment never becomes the only source of meaning.
Implementation notes
Features
Focuses on status, metadata, empty/loading states, or content grouping without owning application state.
Uses DuskMoon tokens so the component follows the active docs theme.
Skeleton is most often configured through `variant`, `animation`, `active`, `loading`.
Renders title and paragraph placeholders by default
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
Basic usage
Import the component stylesheet and Skeleton from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { Skeleton } from "@duskmoon-dev/components/skeleton";
export function Example() {
return (<Skeleton
active
avatar
paragraph={{ rows: 3 }}
style={{ width: "420px", maxWidth: "100%" }}
/>);
} Renders title and paragraph placeholders by default
test-backedSkeleton scenario from the component test coverage: renders title and paragraph placeholders by default.
import "@duskmoon-dev/components/styles.css";
import { Skeleton } from "@duskmoon-dev/components/skeleton";
export function SkeletonRendersTitleAndParagraphDemo() {
return (<Skeleton
active
avatar
paragraph={{ rows: 3 }}
style={{ width: "420px", maxWidth: "100%" }}
/>);
} Renders children when loading is false
test-backedSkeleton scenario from the component test coverage: renders children when loading is false.
import "@duskmoon-dev/components/styles.css";
import { Skeleton } from "@duskmoon-dev/components/skeleton";
export function SkeletonRendersChildrenWhenLoadingDemo() {
return (<Skeleton
active
avatar
paragraph={{ rows: 3 }}
style={{ width: "420px", maxWidth: "100%" }}
/>);
} Applies primitive variant classes
test-backedSkeleton scenario from the component test coverage: applies primitive variant classes.
import "@duskmoon-dev/components/styles.css";
import { Skeleton } from "@duskmoon-dev/components/skeleton";
export function SkeletonAppliesPrimitiveVariantClassesDemo() {
return (<Skeleton
active
avatar
paragraph={{ rows: 3 }}
style={{ width: "420px", maxWidth: "100%" }}
/>);
} Applies compound variant classes
test-backedSkeleton scenario from the component test coverage: applies compound variant classes.
import "@duskmoon-dev/components/styles.css";
import { Skeleton } from "@duskmoon-dev/components/skeleton";
export function SkeletonAppliesCompoundVariantClassesDemo() {
return (<Skeleton
active
avatar
paragraph={{ rows: 3 }}
style={{ width: "420px", maxWidth: "100%" }}
/>);
} Uses wave animation when active and static behavior by default
test-backedSkeleton scenario from the component test coverage: uses wave animation when active and static behavior by default.
import "@duskmoon-dev/components/styles.css";
import { Skeleton } from "@duskmoon-dev/components/skeleton";
export function SkeletonUsesWaveAnimationWhenDemo() {
return (<Skeleton
active
avatar
paragraph={{ rows: 3 }}
style={{ width: "420px", maxWidth: "100%" }}
/>);
} Supports pulse animation without static or wave modifiers
test-backedSkeleton scenario from the component test coverage: supports pulse animation without static or wave modifiers.
import "@duskmoon-dev/components/styles.css";
import { Skeleton } from "@duskmoon-dev/components/skeleton";
export function SkeletonSupportsPulseAnimationWithoutDemo() {
return (<Skeleton
active
avatar
paragraph={{ rows: 3 }}
style={{ width: "420px", maxWidth: "100%" }}
/>);
} Applies custom className
test-backedSkeleton scenario from the component test coverage: applies custom classname.
import "@duskmoon-dev/components/styles.css";
import { Skeleton } from "@duskmoon-dev/components/skeleton";
export function SkeletonAppliesCustomClassNameDemo() {
return (<Skeleton
active
avatar
paragraph={{ rows: 3 }}
style={{ width: "420px", maxWidth: "100%" }}
/>);
} Theme aware
Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.
<div data-theme="sunshine">
<Skeleton
active
avatar
paragraph={{ rows: 3 }}
style={{ width: "420px", maxWidth: "100%" }}
/>
</div>
<div data-theme="moonlight">
<Skeleton
active
avatar
paragraph={{ rows: 3 }}
style={{ width: "420px", maxWidth: "100%" }}
/>
</div> API
The API reference below lists every parsed exported type or interface for Skeleton. Start with `variant`, `animation`, `active`, `loading` for common usage.
packages/components/src/components/skeleton/Skeleton.types.ts
Scenarios: packages/components/src/components/skeleton/Skeleton.test.tsx | Prop | Type | Required | Description |
|---|---|---|---|
variant | SkeletonVariant | No | variant configures Skeleton. |
animation | SkeletonAnimation | No | animation configures Skeleton. |
active | boolean | No | active configures Skeleton. |
loading | boolean | No | loading configures Skeleton. |
avatar | boolean | SkeletonAvatarProps | No | avatar configures Skeleton. |
title | boolean | SkeletonTitleProps | No | title configures Skeleton. |
paragraph | boolean | SkeletonParagraphProps | No | paragraph configures Skeleton. |
round | boolean | No | round configures Skeleton. |
| Prop | Type | Required | Description |
|---|---|---|---|
width | SkeletonWidth | No | width configures Skeleton. |
| Prop | Type | Required | Description |
|---|---|---|---|
rows | number | No | rows configures Skeleton. |
width | SkeletonWidth | SkeletonWidth[] | No | width configures Skeleton. |
| Prop | Type | Required | Description |
|---|---|---|---|
shape | "circle" | "square" | No | shape configures Skeleton. |
| Prop | Type | Required | Description |
|---|---|---|---|
active | boolean | No | active configures Skeleton. |
animation | SkeletonAnimation | No | animation configures Skeleton. |
round | boolean | No | round configures Skeleton. |
| Prop | Type | Required | Description |
|---|---|---|---|
shape | "circle" | "square" | No | shape configures Skeleton. |
| Prop | Type | Required | Description |
|---|---|---|---|
children | ReactNode | No | children configures Skeleton. |
| "text" | "circle" | "rect" | "button" | "input" | "card" "pulse" | "wave" | "none" "full" | "threeQuarter" | "half" | "quarter"