Skeleton
Pulsing placeholder block that holds the space of content that is still loading.
import { cn } from "@/lib/utils"
/*
* Adapted from shadcn/ui (https://github.com/shadcn-ui/ui).
*
* MIT License
*
* Copyright (c) 2023 shadcn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="skeleton"
className={cn("animate-pulse rounded-md bg-accent", className)}
{...props}
/>
)
}
export { Skeleton }Installation
pnpm dlx shadcn@latest add @ward/skeletonnpx shadcn@latest add @ward/skeletonyarn dlx shadcn@latest add @ward/skeletonbunx --bun shadcn@latest add @ward/skeletonAdd the Ward registry to components.json once:
"registries": {
"@ward": "https://ward.so/r/{name}.json"
}Or install from the URL with no configuration: npx shadcn@latest add https://ward.so/r/skeleton.json
Copy each file from the Code tab into:
components/ui/skeleton.tsx
Update the import paths to match your project.
Usage
import { Skeleton } from "@/components/ui/skeleton";<div className="flex items-center gap-3">
<Skeleton className="size-10 rounded-full" />
<div className="grid gap-2">
<Skeleton className="h-4 w-40" />
<Skeleton className="h-4 w-24" />
</div>
</div>Props
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | - | Size and shape the placeholder with utility classes, such as h-4 w-40 or size-10 rounded-full. |
Ward · Version 1.0.0 · Registry manifest