API Reference
Everything you can pass to <Skeleton> and the build CLI.
<Skeleton> propsloadingbooleanrequiredtrue, shows the skeleton. When false, shows your real content.childrenReactNoderequirednamestringrequired.bones.json file.Example:
name="blog-card" → generates blog-card.bones.jsoninitialBonesResponsiveBonesOptional manual override — pass a bones JSON file directly to a specific Skeleton. If you use the registry (import './bones/registry' in your app entry), you don't need this prop. The registry auto-resolves bones by name.
colorstringdefault: #e0e0e0animatebooleandefault: truefalse if you want static gray rectangles with no animation.classNamestringfallbackReactNodefixtureReactNodeMock content rendered during npx boneyard-js build so the CLI can capture bone positions even when real data isn't available (e.g., behind authentication, user-specific data, or API-dependent content).
Only rendered when the CLI is running — never used in production.
snapshotConfigSnapshotConfigFull example
// Registry auto-resolves bones — no per-file JSON import needed
import { Skeleton } from 'boneyard/react'
function BlogPage() {
const { data, isLoading } = useFetch('/api/post')
return (
<Skeleton
name="blog-card"
loading={isLoading}
color="#d4d4d4"
>
{data && <BlogCard data={data} />}
</Skeleton>
)
}Sometimes you don't want everything to show up in the skeleton. Maybe you have icons, decorative elements, or a live widget that should always be visible. You can tell boneyard to skip them.
Pass a snapshotConfig prop to control what gets included:
Skip specific elements by CSS class or attribute
Use excludeSelectors — any CSS selector works. The element and everything inside it gets ignored.
<Skeleton
name="dashboard"
loading={isLoading}
initialBones={dashBones}
snapshotConfig={{
excludeSelectors: [
'.icon', // skip all icons
'[data-no-skeleton]', // skip anything with this attribute
'svg', // skip all SVGs
]
}}
>Skip entire HTML tags
Use excludeTagsto skip every instance of a tag type. Good for nav bars and footers that shouldn't be part of the skeleton.
snapshotConfig={{
excludeTags: ['nav', 'footer', 'aside']
}}Mark elements in your JSX
The easiest way — add data-no-skeleton to any element you want to hide, then exclude it:
// This chart will always render, even during loading
<div data-no-skeleton>
<LiveChart />
</div>
// Then in your Skeleton wrapper
snapshotConfig={{ excludeSelectors: ['[data-no-skeleton]'] }}Other snapshot options
leafTags— Tags treated as one solid block (default:p, h1–h6, li, tr). Addspanif your text renders inside span wrappers.captureRoundedBorders— Setfalseif your cards use shadows instead of borders (default:true).
This is how you generate the bones JSON files. Run it with your dev server running:
npx boneyard-js buildIt opens a headless browser, visits your app, finds every <Skeleton name="...">, measures the layout at different screen sizes, and saves the result as JSON files you can import.
urlpositionaldefault: auto-detected--breakpointsstringdefault: 375,768,1280--waitnumberdefault: 800--outstringdefault: ./src/bonessrc/bones/ if you have a src/ folder, otherwise ./bones/.Examples
# Auto-detect server, default breakpoints
npx boneyard-js build
# Specific page
npx boneyard-js build http://localhost:3000/dashboard
# Multiple pages at once
npx boneyard-js build http://localhost:3000 http://localhost:3000/profile
# Custom breakpoints + output dir
npx boneyard-js build --breakpoints 390,820,1440 --out ./public/bonesPlaywright is included as a dependency. On first run you may need to install the browser: npx playwright install chromium