Search for a command to run...
Use to show a placeholder while content is loading.
npx shadcn@latest add @zaidan/skeletonpnpx shadcn add @zaidan/skeletonyarn dlx shadcn@latest add @zaidan/skeletonbunx shadcn@latest add @zaidan/skeletonInstall the following dependencies:
npm i @kobalte/corepnpm add @kobalte/coreyarn add @kobalte/corebun add @kobalte/coreCopy and paste the following code into your project.
1import type { ComponentProps } from "solid-js";2import { splitProps } from "solid-js";3
4import { cn } from "~/lib/utils";5
6const Skeleton = (props: ComponentProps<"div">) => {7 const [local, others] = splitProps(props, ["class"]);8 return (9 <div class={cn("z-skeleton animate-pulse", local.class)} data-slot="skeleton" {...others} />10 );11};12
13export { Skeleton };Here are the source code of all the examples from the preview page:
import { Skeleton } from "~/components/ui/skeleton";function SkeletonAvatar() { return ( <Example title="Avatar"> <div class="flex w-full items-center gap-4"> <Skeleton class="size-10 shrink-0 rounded-full" /> <div class="grid gap-2"> <Skeleton class="h-4 w-[150px]" /> <Skeleton class="h-4 w-[100px]" /> </div> </div> </Example> );}import { Card, CardContent, CardHeader } from "~/components/ui/card";import { Skeleton } from "~/components/ui/skeleton";function SkeletonCard() { return ( <Example title="Card"> <Card class="w-full"> <CardHeader> <Skeleton class="h-4 w-2/3" /> <Skeleton class="h-4 w-1/2" /> </CardHeader> <CardContent> <Skeleton class="aspect-square w-full" /> </CardContent> </Card> </Example> );}import { Skeleton } from "~/components/ui/skeleton";function SkeletonText() { return ( <Example title="Text"> <div class="flex w-full flex-col gap-2"> <Skeleton class="h-4 w-full" /> <Skeleton class="h-4 w-full" /> <Skeleton class="h-4 w-3/4" /> </div> </Example> );}import { Skeleton } from "~/components/ui/skeleton";function SkeletonForm() { return ( <Example title="Form"> <div class="flex w-full flex-col gap-7"> <div class="flex flex-col gap-3"> <Skeleton class="h-4 w-20" /> <Skeleton class="h-10 w-full" /> </div> <div class="flex flex-col gap-3"> <Skeleton class="h-4 w-24" /> <Skeleton class="h-10 w-full" /> </div> <Skeleton class="h-9 w-24" /> </div> </Example> );}import { Skeleton } from "~/components/ui/skeleton";function SkeletonTable() { return ( <Example title="Table"> <div class="flex w-full flex-col gap-2"> <div class="flex gap-4"> <Skeleton class="h-4 flex-1" /> <Skeleton class="h-4 w-24" /> <Skeleton class="h-4 w-20" /> </div> <div class="flex gap-4"> <Skeleton class="h-4 flex-1" /> <Skeleton class="h-4 w-24" /> <Skeleton class="h-4 w-20" /> </div> <div class="flex gap-4"> <Skeleton class="h-4 flex-1" /> <Skeleton class="h-4 w-24" /> <Skeleton class="h-4 w-20" /> </div> </div> </Example> );}