Octocat

Skeleton

A component to display a replacement for content while loading.

import { Skeleton } from '@/components/skeleton';

export default function SkeletonExample() {
  return (
    <div className="flex items-center gap-1">
      <Skeleton className="size-10 rounded-full" />
      <div className="flex flex-col gap-1">
        <Skeleton className="h-4 w-24" />
        <Skeleton className="h-4 w-32" />
      </div>
    </div>
  );
}

Source Code

'use client';

import { cn } from '@/lib/utils/classnames';

const Skeleton = ({
  className,
  ...props
}: React.ComponentPropsWithRef<'div'>) => {
  return (
    <div
      className={cn('animate-pulse rounded-md bg-foreground/10', className)}
      {...props}
    />
  );
};

export { Skeleton };

API Reference

Extends the div element.

Previous

Select

Next

Slider