PeakUI

Skeleton

A placeholder showing the shape of content that is still loading

Usage

import {Skeleton} from "@peakui/react";

Skeletons are decorative: the component sets no role, so hide them from assistive technology with aria-hidden when they stand alone.

Examples

Text Content

User Profile

List Items

Grid

Single Shimmer

Put the skeleton--shimmer class on a parent and animationType="none" on the children for one synchronized shimmer passing over all of them.

Animation Types

animationType picks the animation per component; shimmer is the default.

Customization

Tailwind CSS

Size and shape come from the consumer — the block itself ships with no dimensions.

<Skeleton className="h-32 w-full rounded-xl" />

Global CSS

Set --skeleton-animation on :root to change the default animation type for every Skeleton at once; the animationType prop still wins per component.

@layer components {
  .skeleton {
    @apply bg-surface-secondary/70;
  }

  .skeleton--pulse {
    @apply animate-pulse;
  }
}

:root {
  /* Possible values: shimmer, pulse, none */
  --skeleton-animation: pulse;
}

Styling Reference

PeakUI follows the BEM methodology, so variants and states are plain class names you can target.

CSS Classes

The Skeleton component uses these CSS classes (view source styles):

Base Class

  • .skeleton - Base skeleton styles with background and rounded corners

Animation Variant Classes

  • .skeleton--shimmer - Shimmer animation with a moving gradient (default)
  • .skeleton--pulse - Pulse animation
  • .skeleton--none - Static placeholder without animation

Slots

  • [data-slot="skeleton"] - The root element

API Reference

Skeleton

PropTypeDefaultDescription
animationType'shimmer' | 'pulse' | 'none''shimmer' or --skeleton-animationAnimation type; the CSS variable sets the app-wide default
classNamestring-Additional classes
renderDOMRenderFunction<'div', undefined>-Replaces the rendered <div> with your own element

Every other attribute of a <div> is accepted.

On this page