Drivn vs shadcn/ui — Skeleton Compared
Compare Drivn Skeleton vs shadcn/ui — a custom opacity keyframe on bg-muted/80 versus Tailwind's animate-pulse on bg-accent. Both copy-paste, both server-safe.
Skeleton is the one component where Drivn and shadcn/ui look almost identical on paper, which is exactly why the small differences deserve a close read. Each library ships a single server-safe <div> that spreads React.HTMLAttributes<HTMLDivElement>, merges your className through cn(), and hands every size and shape decision to Tailwind utilities. Neither needs a client boundary, a hook, or any package beyond that helper.
The split lives in the two classes that decide how a placeholder feels on screen. shadcn/ui renders bg-accent animate-pulse rounded-md: the theme's hover surface, faded by Tailwind's stock pulse keyframe down to half opacity. Drivn's Skeleton renders bg-muted/80 rounded-md animate-skeleton: the muted surface at eighty percent, faded by a dedicated skeleton keyframe that dips to 0.4. The deeper floor makes the loading state easier to spot against busy cards, the translucent surface lets a coloured container tint through, and because the motion is a named theme token, retuning every placeholder in the app is a single edit rather than a search across files.
The comparison table lines up both files first. The sections then cover the keyframe and where it must be declared, the surface token, sizing through className, and rendering inside Suspense fallbacks. When you want to try it, the Drivn CLI adds the file in one command.
Side-by-side comparison
| Feature | Drivn | shadcn/ui |
|---|---|---|
| Underlying element | Single div with HTMLAttributes spread | Single div with HTMLAttributes spread |
| Runtime UI dependencies | cn() utility only | cn() utility only |
| Animation | animate-skeleton (custom keyframe, ease-in-out, opacity 1 → 0.4) | animate-pulse (Tailwind built-in, cubic-bezier, opacity 1 → 0.5) |
| Surface token | bg-muted/80 | bg-accent |
| Shape | rounded-md (override via className) | rounded-md (override via className) |
| Client component | No — server-safe | No — server-safe |
| Props | className + HTMLAttributes<HTMLDivElement> | className + HTMLAttributes<HTMLDivElement> |
| License | MIT | MIT |
| Copy-paste install |
A custom keyframe instead of animate-pulse
shadcn/ui reaches for Tailwind's built-in animate-pulse, which maps to a stock pulse keyframe: opacity drops to 0.5 at the midpoint on a cubic-bezier(0.4, 0, 0.6, 1) curve, two seconds per cycle, forever. Because it is a framework default, changing it means overriding Tailwind's token for every component that pulses, not just your placeholders.
Drivn's Skeleton calls animate-skeleton instead — a named animation registered in the @theme inline block of src/styles/globals.css on the Drivn site, paired with a skeleton keyframe that holds full opacity at both ends and dips to 0.4 halfway through on ease-in-out. The curves are close; the visible difference is the deeper floor, and the real win is ownership. One thing to know before installing: the CLI writes the component file, while the animation token belongs in your own global stylesheet. Copy the two declarations below into your @theme inline block — without them the placeholder still renders, just static. After that, every Skeleton, including the loading rows of the Data Table, retimes from one token that nothing else depends on.
1 /* globals.css — inside @theme inline, verbatim */ 2 --animate-skeleton: skeleton 2s ease-in-out infinite; 3 4 @keyframes skeleton { 5 0%, 100% { opacity: 1; } 6 50% { opacity: 0.4; } 7 }
bg-muted/80 instead of bg-accent
The colour choice is the second visible split. shadcn's current Skeleton uses bg-accent, which resolves to the theme's subtle hover surface — a near-neutral that sits just above the page background. The block stays solid and reads as a flat shape.
Drivn uses bg-muted at eighty percent opacity. bg-muted is the same token the text-muted-foreground colour pairs against, so the placeholder visually belongs to the same secondary surface used elsewhere in the design system. The trailing /80 keeps the block slightly translucent — when stacked over a coloured panel or a card with its own background, the Skeleton tints rather than blocks. Pair it with the Card for product cards or the Avatar for a circular profile placeholder and the muted-with-opacity choice lets the surrounding container show through.
1 // Drivn — verbatim from the registry 2 return ( 3 <div 4 className={cn( 5 'bg-muted/80 rounded-md animate-skeleton', 6 className 7 )} 8 {...props} 9 /> 10 )
Sizing and shape live entirely in className
Both libraries put the sizing decision on the caller. The base classes — bg-muted/80 rounded-md animate-skeleton in Drivn, animate-pulse rounded-md bg-accent in shadcn — set the surface and the animation; the width, height, and (optional) round-pill shape come from the className you pass. There is no size prop, no variant union, no width/height attributes.
The Skeleton docs preview leans on this directly: a 12-unit circle (size-12 rounded-full) for the avatar slot, a 5-unit-tall by 40-unit-wide rectangle for a heading line, and a 4-unit-tall by 60-unit-wide rectangle for the body line beneath it. The rounded-md in the base class only matters when you do not pass your own rounding utility — rounded-full, rounded-none, or any rounded-{size} later in the className wins thanks to cn(). Treat the component as a styled <div> whose only job is to be the right shape for the content it is standing in for.
1 import { Skeleton } from "@/components/ui/skeleton" 2 3 export default function UserCardSkeleton() { 4 return ( 5 <div className="flex items-center gap-4"> 6 <Skeleton className="size-12 rounded-full" /> 7 <div className="flex flex-col gap-2"> 8 <Skeleton className="h-5 w-40" /> 9 <Skeleton className="h-4 w-60" /> 10 </div> 11 </div> 12 ) 13 }
Server-safe, no hydration cost
Neither component is marked 'use client'. Both are plain functions that spread HTMLAttributes<HTMLDivElement> onto a single div, which means both can render directly inside server components, layouts, and statically rendered pages. The animation is CSS — the browser drives it, not React — so there is no JavaScript cost beyond the bytes of the component file itself.
That matters for loading states inside route segments that you want to keep server-rendered. A product grid that streams in with Suspense fallbacks, a profile page with an avatar placeholder above the fold, a list page with row-shaped skeletons — none of these need a client boundary just because they show a Skeleton during data fetch. Pair the component with a <Suspense fallback={<UserCardSkeleton />}> boundary and the fallback renders on the server, the animation plays via CSS, and the real content swaps in when the data resolves. Use the Drivn CLI to add the file to your project in one command.
1 // app/profile/page.tsx — server component, no 'use client' 2 import { Suspense } from "react" 3 import { Skeleton } from "@/components/ui/skeleton" 4 import { ProfileCard } from "./profile-card" 5 6 export default function ProfilePage() { 7 return ( 8 <Suspense 9 fallback={ 10 <div className="flex items-center gap-4"> 11 <Skeleton className="size-12 rounded-full" /> 12 <Skeleton className="h-5 w-40" /> 13 </div> 14 } 15 > 16 <ProfileCard /> 17 </Suspense> 18 ) 19 }
Install Drivn in one command
Copy the source into your project and own every line. Zero runtime dependencies, pure React + Tailwind.
npx drivn@latest createRequires Node 18+. Works with npm, pnpm, and yarn.
Frequently asked questions
A dedicated keyframe keeps placeholder motion separate from everything else that pulses. Tailwind's animate-pulse fades to 0.5 opacity; Drivn's animate-skeleton fades to 0.4 on ease-in-out, a slightly deeper dip. Because it is its own token in the @theme inline block of your global stylesheet, tweaking the timing or the opacity floor is a one-line change that updates every Skeleton at once.
Yes. Both the surface (bg-muted/80) and the shape (rounded-md) are in the base className, and cn() merges with later-class precedence. Pass className="bg-primary/10" for a brand-tinted placeholder, className="rounded-full" for a circular avatar slot, or className="rounded-none" for a sharp-edged bar. Width and height live entirely in className via the usual Tailwind utilities (h-4, w-60, size-12).
No. The component has no 'use client' directive, no hooks, no refs, and no event handlers. It spreads HTMLAttributes<HTMLDivElement> onto a single div with the animation class. You can render it inside server components, layouts, statically generated pages, and Suspense fallbacks without crossing a client boundary or adding to the JavaScript bundle for that route.
A spinner indicates that something is loading without showing where. A Skeleton indicates loading and reserves the exact shape of the content that is about to appear — same height, same width, same rounded corners. The layout does not shift when the real content arrives, which avoids the cumulative layout shift cost that a spinner-to-content swap can introduce on a Core Web Vitals score.