Skeleton
- Status
- Implemented
- Family
- 8 of 13
- Registry
- @lopifi/skeleton
npx shadcn@latest add @lopifi/theme @lopifi/skeletonThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
Structural, matching the exact shape, position, and radii of the content it replaces. Slow breathe (opacity 0.6↔1, 1.6s) permitted; no shimmer sweep — a translating gradient across a full-page skeleton is large-surface paint animation and the clearest template tell there is.
A skeleton that doesn't match causes a jump when content lands, and that jump is worse than no skeleton at all.
Lifted verbatim from System & states. The doc and this page are the same paragraphs, so they cannot disagree.
What lands in your repository
One component is never one file. Everything below is copied into your project, where you own it.
- Files
components/ledger/skeleton.tsx
- Lopifi dependencies · 1
- cn
- npm packages
- clsxtailwind-merge
- Registry entry
- /r/skeleton.json
The whole component
No compiled bundle, no black box. This is the file the registry copies, and the file you will edit.
import * as React from "react";
import { cn } from "@/lib/ledger/cn";
export interface SkeletonProps extends React.ComponentPropsWithoutRef<"div"> {
height?: number | string;
radius?: "xs" | "sm" | "md" | "lg" | "xl";
width?: number | string;
}
/**
* Structural, matching the exact shape, position and radii of what it
* replaces. A slow breathe is permitted; a shimmer sweep is not — a
* translating gradient across a full-page skeleton is the clearest
* template tell there is.
*/
export const Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(
({ className, width, height = 16, radius = "xs", ...props }, ref) => (
<div
aria-hidden="true"
className={cn("ledger-breathe bg-surface-sunken", `rounded-${radius}`, className)}
ref={ref}
style={{ height, width }}
{...props}
/>
),
);
Skeleton.displayName = "Skeleton";
/**
* The figure block reserves the exact figure width, or the card jumps when
* the data lands — and that jump is worse than no skeleton at all.
*/
export function KpiCardSkeleton({ className }: { className?: string }) {
return (
<div
aria-busy="true"
aria-label="Loading metric"
className={cn("rounded-xl border border-border bg-surface p-6", className)}
role="status"
>
<Skeleton height={16} width={112} />
<Skeleton className="mt-2" height={32} radius="sm" width={168} />
<Skeleton className="mt-2" height={16} width={136} />
</div>
);
}
export function TableSkeleton({ rows = 6, className }: { rows?: number; className?: string }) {
return (
<div aria-busy="true" className={cn("rounded-xl border border-border bg-surface", className)}>
{Array.from({ length: rows }, (_, i) => (
<div
className="flex h-10 items-center gap-4 border-b border-border-subtle px-4 last:border-b-0"
key={i}
>
<Skeleton height={12} width={64} />
<Skeleton height={12} width="35%" />
<Skeleton className="ml-auto" height={12} width={80} />
</div>
))}
</div>
);
}
export function StatementSkeleton({ className }: { className?: string }) {
return (
<div aria-busy="true" className={cn("space-y-2", className)}>
{[80, 60, 70, 55, 90].map((w, i) => (
<div className="flex items-center justify-between gap-8" key={i}>
<Skeleton className="max-w-[220px]" height={12} width={`${w}%`} />
<Skeleton height={12} width={72} />
</div>
))}
</div>
);
}
Also in System & states
- EmptyStateThree variants. Always one next action.
- ErrorStateWith the financial reassurance sentence.
- StaleIndicatorLast-synced + retry.
- ToastSonner, configured to our tokens.
- CommandPaletteMotionless. Money-aware search.
- SheetVaul, configured. The mobile primary overlay.
- HoldToConfirmIrreversible actions, with accessible fallbacks.
- DensityTogglePersisted, synced, phone-clamped.
See also
A component is specified in one place, defined in another, and running in a third. All three, from here.
- System & states — the family specThe four-layer specification this component was built against, before it was written.Doc
- States, density and system componentsThe family running, with real figures in it, in both themes and at every density.Live
- CatalogAll 179 components, specified before they are written.Doc
Elsewhere in the system
Where Skeleton sits in the rest of the system — the live section it renders in, the calculators that compute what it displays, and the ledger payloads it is fed from.
- Skeleton, runningThe system showcase — live, with theme, density, greyscale and reduced-motion switches.Live
- Webhooks and freshnessHow do you find out something changed?API
- System & statesThe states that decide whether a product feels finished. Specs for 9 React components: EmptyState, ErrorState, Skeleton, StaleIndicator and 5 more.Doc
Components are copied into your repository and meant to be edited — rounding policy, fiscal calendar and compliance copy differ per company.
Told when System & states changes
Components are copied into your repo, so a fix here does not reach you on its own. One email when a component in this family changes in a way that needs a migration — and nothing when it does not.