1.0.0 • Published 7 months ago

@darksnow-ui/skeleton v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Skeleton

Use to show a placeholder while content is loading.

Installation

npm install @darksnow-ui/skeleton

Peer Dependencies

npm install react react-dom

Usage

import { Skeleton } from "@darksnow-ui/skeleton"

export function SkeletonExample() {
  return (
    <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>
  )
}

Props

PropTypeDefaultDescription
classNamestring-Additional CSS classes

Examples

Basic Skeleton

<Skeleton className="w-[100px] h-[20px] rounded-full" />

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 and Text

<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 Skeleton

<div className="space-y-2">
  <Skeleton className="h-4 w-full" />
  <Skeleton className="h-4 w-full" />
  <Skeleton className="h-4 w-3/4" />
  <Skeleton className="h-4 w-1/2" />
</div>

Styling

The Skeleton component uses:

  • animate-pulse for the loading animation
  • bg-theme-accent/10 for the background color
  • rounded-md for default border radius

Accessibility

  • Uses appropriate ARIA labels for loading states
  • Screen reader friendly

Related Components

1.0.0

7 months ago