Skeleton
indiacn/skeletonFreeComponent
Loading placeholder with rect/circle/pill/text shapes and pulse/wave animations.
Install it
npx shadcn@latest add https://indiacn.in/r/skeleton.jsonSource
1import { cva, type VariantProps } from 'class-variance-authority';2import { ComponentProps } from 'react';34import { cn } from '@/lib/utils';56/*7 * UX4G skeleton: background-color neutral-100, pulse/wave animation.8 * Shape variants cover typical loading states (line, avatar, thumbnail, rectangle).9 */10const SKELETON_VARIANTS = cva('bg-neutral-100', {11 variants: {12 shape: {13 rect: 'rounded-md',14 circle: 'rounded-full',15 pill: 'rounded-full',16 text: 'rounded w-full h-4',17 },18 animation: {19 pulse: 'animate-pulse',20 wave: 'relative overflow-hidden before:absolute before:inset-0 before:-translate-x-full before:animate-[shimmer_2s_infinite] before:bg-[linear-gradient(90deg,transparent,rgba(255,255,255,0.4),transparent)]',21 none: '',22 },23 },24 defaultVariants: {25 shape: 'rect',26 animation: 'pulse',27 },28});2930interface ISkeletonProps extends ComponentProps<'div'>, VariantProps<typeof SKELETON_VARIANTS> {}3132/** Placeholder loading skeleton. */33function Skeleton({ className, shape, animation, ...props }: ISkeletonProps) {34 return <div className={cn(SKELETON_VARIANTS({ shape, animation, className }))} {...props} />;35}3637export { Skeleton, SKELETON_VARIANTS };
What it pulls in
npm packages
Other registry items
Files it writes
More from indiacn
All 26 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | indiacn | Components | Free | 2 deps | |
| Alertalert | indiacn | Components | Free | 2 deps | |
| Badgebadge | indiacn | Components | Free | 1 dep | |
| Breadcrumbbreadcrumb | indiacn | Components | Free | 1 dep | |
| Buttonbutton | indiacn | Components | Free | 3 deps | |
| Button Groupbutton-group | indiacn | Components | Free | no deps | |
| Cardcard | indiacn | Components | Free | 1 dep | |
| Chipchip | indiacn | Components | Free | 2 deps |
