Pittaya UI
Pittaya UI
Links

Search Components

Search for components by name, description, category or tags

Feedbackstable

Skeleton

A placeholder component that displays a visual representation of loading content with customizable animation variants.

Installation

Install the component directly into your project using the Pittaya CLI.

npx pittaya@latest add skeleton

When to use

Use Skeleton when you need to indicate that content is loading, providing users with visual feedback while data is being fetched or processed. This improves perceived performance and user experience.

The component is ideal for data-heavy applications, dashboards, profile pages, product listings, and any scenario where content takes time to load. It helps maintain layout stability and reduces the jarring effect of content suddenly appearing.

Best practices

  • Match the skeleton shape and size to the actual content that will appear, maintaining the same layout structure.
  • Use the pulse variant for general loading states as it's subtle and widely recognized.
  • Choose shimmer variant for premium interfaces or when you want to create a more polished, sophisticated loading experience.
  • Display skeletons for at least 300-500ms to prevent flashing if content loads very quickly.
  • Group multiple skeletons to represent complex layouts like cards, tables, or forms.
  • Avoid overusing skeletons; only show them for content that takes noticeable time to load (typically >200ms).

Accessibility

The Skeleton component is primarily visual and should be used alongside proper ARIA attributes to communicate loading states to assistive technologies.

Consider wrapping skeleton content with aria-busy="true" and aria-label="Loading content" on the parent container. When content loads, ensure focus management is handled appropriately for screen reader users.

The animations (pulse and shimmer) use prefers-reduced-motion media query automatically through Tailwind, respecting user preferences for reduced motion.

Variants

Pulse (default)

A subtle pulsing animation that fades the skeleton opacity in and out. This is the most common loading indicator and works well in most contexts.

Shimmer

A gradient reflection that moves across the skeleton from left to right, creating a shimmering effect. This variant feels more premium and modern, similar to what you see in high-end apps like LinkedIn, Facebook, and Instagram.

Examples

Combine variants and sizes to meet your needs.

Basic usage

Simple skeleton loaders with different dimensions demonstrating the default pulse animation.

Animation variants

Side-by-side comparison of pulse and shimmer animation variants.

Pulse (default)

Shimmer

User profile skeleton

A realistic skeleton for a user profile card, demonstrating how to structure loading states for complex layouts.

Product card skeleton

Loading state for an e-commerce product card with image, title, price, and action button placeholders.

Article list skeleton

Loading state for a blog or news article list, showing multiple skeleton items in a vertical layout.

Properties

TSX interface that combines variants and default attributes.

PropTypeDefaultDescription
variant
'pulse' | 'shimmer''pulse'Defines the animation style. 'pulse' creates a subtle fade effect, while 'shimmer' produces a moving gradient reflection.
className
stringAdditional Tailwind classes to customize size, shape, and other styles.