# Skeleton
A pulsing placeholder in the shape of content that is still loading.
Source page: https://dinachi.dev/docs/components/skeleton

## Installation
```bash
npx @dinachi/cli@latest add skeleton
```
Adds to your project:
- `components/ui/skeleton/skeleton.tsx`
- `components/ui/skeleton/index.ts`

## Usage
```tsx
import { Skeleton } from "@/components/ui/skeleton"

export function ProfileLoading() {
  return <Skeleton className="h-12 w-12 rounded-full" />
}
```

## Examples

### Default
An avatar and two lines of text.
```tsx
import { Skeleton } from '@/components/ui/skeleton';

export function Example() {
  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>
  );
}
```

### Card
A placeholder for a card with an image.
```tsx
import { Skeleton } from '@/components/ui/skeleton';

export function Example() {
  return (
    <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>
  );
}
```

## Notes

### Match the content
Size each skeleton to the element it replaces so the layout does not jump. Compose several for a card or row.

### Avoiding a flash
A fast load flashes the skeleton for one frame. [Load Transition](/docs/components/load-transition) delays it and holds it for a minimum time once shown.

## API reference

### Skeleton
A pulsing `div`, shaped with classes.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` | - | Sets the size and shape, for example `h-4 w-48` or `rounded-full`. |

## Accessibility
- A plain div with no role; nothing is announced.
- Mark loading with aria-busy on the region the skeletons fill.
- `animate-pulse` keeps running under reduced motion. Add `motion-reduce:animate-none` to stop it.

## Source
`components/ui/skeleton/skeleton.tsx`
```tsx
import { cn } from "@/lib/utils"

function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="skeleton"
      className={cn("animate-pulse rounded-md bg-muted", className)}
      {...props}
    />
  )
}

export { Skeleton }
```
