GitHub

Skeleton

A placeholder component for loading states that mimics the shape of content.

Basic Usage

Loading...
SkeletonLoading placeholder shapes

Installation

pnpm add @corew500/ui

Usage

import { Skeleton } from "@mordecai-design-system/ui"
<Skeleton className="w-[100px] h-[20px] rounded-full" />

Examples

Card Skeleton

<div className="flex flex-col space-y-3">
  <Skeleton className="h-[125px] w-[250px] rounded-xl" />
  <div className="space-y-2">
    <Skeleton className="h-4 w-[250px]" />
    <Skeleton className="h-4 w-[200px]" />
  </div>
</div>

Avatar Skeleton

<div className="flex items-center space-x-4">
  <Skeleton className="h-12 w-12 rounded-full" />
  <div className="space-y-2">
    <Skeleton className="h-4 w-[250px]" />
    <Skeleton className="h-4 w-[200px]" />
  </div>
</div>

Table Row Skeleton

<div className="space-y-2">
  {Array.from({ length: 5 }).map((_, i) => (
    <div key={i} className="flex items-center space-x-4">
      <Skeleton className="h-4 w-[50px]" />
      <Skeleton className="h-4 w-[150px]" />
      <Skeleton className="h-4 w-[100px]" />
    </div>
  ))}
</div>

Props

Skeleton accepts all standard div element props. Use className to control size and shape.

// Common sizing patterns
<Skeleton className="h-4 w-full" />           // Text line
<Skeleton className="h-12 w-12 rounded-full" /> // Avatar
<Skeleton className="h-[200px] rounded-xl" />   // Card