Skeleton
patchui/skeletonFreeComponent
patchui publishes no description for this item.
Install it
npx shadcn@latest add https://ui.hotfix.jobs/r/skeleton.jsonSource
1import type * as React from "react";2import { cn } from "@/lib/utils";34export interface SkeletonProps5 extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {6 /** Number → px; string passed through. */7 width?: number | string;8 /** Number → px; string passed through. */9 height?: number | string;10 shape?: "rounded" | "pill" | "squared";11 animated?: boolean;12 /** When false, render `children` instead of the skeleton. */13 show?: boolean;14 children?: React.ReactNode;15}1617/** Placeholder for async content. */18export function Skeleton({19 className,20 width,21 height,22 shape = "rounded",23 animated = true,24 show = true,25 children,26 style,27 ...props28}: SkeletonProps): React.ReactElement {29 if (!show) return <>{children}</> as unknown as React.ReactElement;3031 const dimStyle: React.CSSProperties = {32 ...(width != null && { width: typeof width === "number" ? `${width}px` : width }),33 ...(height != null && { height: typeof height === "number" ? `${height}px` : height }),34 ...style,35 };3637 return (38 <div39 aria-hidden="true"40 data-slot="skeleton"41 className={cn(42 "bg-fill-2",43 shape === "rounded" && "rounded-[var(--radius-6)]",44 shape === "squared" && "rounded-none",45 shape === "pill" && "rounded-full",46 animated &&47 "animate-[patch-skeleton-pulse_1.8s_ease-in-out_infinite] motion-reduce:animate-none",48 className,49 )}50 style={dimStyle}51 {...props}52 />53 );54}
What it pulls in
Other registry items
Files it writes
More from patchui
All 51 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | patchui | Components | Free | 2 deps | |
| Avataravatar | patchui | Components | Free | 3 deps | |
| Badgebadge | patchui | Components | Free | 2 deps | |
| Breadcrumbbreadcrumb | patchui | Components | Free | 1 dep | |
| Buttonbutton | patchui | Components | Free | 2 deps | |
| Calendarcalendar | patchui | Components | Free | 1 dep | |
| Cardcard | patchui | Components | Free | 1 dep | |
| Checkboxcheckbox | patchui | Components | Free | 2 deps |
