Skip to content

Skeleton

Placeholder blocks shown while content is loading, reducing user wait anxiety.

Basic Usage

tsx
import { Skeleton } from '@airo-ui/react'

function Demo() {
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
      <Skeleton width="100%" height={20} />
      <Skeleton width="48px" height="48px" rounded />
      <Skeleton width="100%" height={120} />
    </div>
  )
}

Disable Animation

tsx
<Skeleton width="300px" height={100} animated={false} />

With Children (Loading Wrapper)

tsx
import { useState } from 'react'

function Demo() {
  const [loading, setLoading] = useState(true)

  return (
    <Skeleton animated={loading}>
      {!loading && <ContentComponent />}
    </Skeleton>
  )
}

API

Props

NameTypeDefaultDescription
widthstring | number--Width
heightstring | number20Height
roundedbooleanfalseFull border-radius (for circle/avatar)
animatedbooleantrueShow shimmer animation
childrenReact.ReactNode--Content to render when not loading

Interaction

  • Shows shimmer sweep animation by default
  • Animation disabled with prefers-reduced-motion

MIT License