Browse components · Skeleton
Start here
DocsDisplay
Skeleton
A light pencil sketch while content loads.
Install
$ npx shadcn@latest add @ephemera/skeleton$ npx shadcn@latest add https://ephemera.kerrshift.com/r/skeleton.jsonInstalls the component, its Radix dependency and the paper theme if you don't have it yet. Prefer copying? The full source is below.
Usage
example.tsx
import { Skeleton } from "@/components/ui/skeleton";
<div className="flex items-center gap-4">
<Skeleton className="size-12 rounded-full" />
<div className="space-y-2">
<Skeleton className="h-4 w-48" />
<Skeleton className="h-4 w-32" />
</div>
</div>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | Size and shape it with Tailwind classes. |
Any other props are passed to the root element.
Fonts
Installed automatically with the paper theme: Fraunces (--font-display), IBM Plex Mono (--font-receipt), Courier Prime (--font-type), Caveat (--font-hand) and Anton (--font-stamp). Override any of those variables to use your own fonts.
Source
components/ui/skeleton.tsx
import * as React from "react";
/** A light pencil sketch where content will go. */
export function Skeleton({ className = "", style, ...props }: React.HTMLAttributes<HTMLDivElement>) {
return (
<div
aria-hidden
data-paper-motion
className={`rounded-[2px] ${className}`}
style={{
background:
"repeating-linear-gradient(-45deg, color-mix(in srgb, var(--ink) 16%, transparent) 0 1px, transparent 1px 6px) 0 0 / 24px 24px",
boxShadow: "inset 0 0 0 1px color-mix(in srgb, var(--ink) 12%, transparent)",
animation: "paper-sketch 1.4s linear infinite",
...style,
}}
{...props}
/>
);
}