Skeleton | jaspr_daisyui_components
jaspr_daisyui_components
pub.dev ↗

Skeleton

Skeleton is a component that can be used to show a loading state of a component.

Class name Type Description
skeleton Component A placeholder div with loading animation
skeleton-text Modifier Animates the text color instead of background color

Skeleton

<div class="skeleton h-32 w-32"></div>
div(const [], classes: 'skeleton h-32 w-32');

Skeleton - circle with content

<div class="flex w-52 flex-col gap-4">
  <div class="flex items-center gap-4">
    <div class="skeleton h-16 w-16 shrink-0 rounded-full"></div>
    <div class="flex flex-col gap-4">
      <div class="skeleton h-4 w-20"></div>
      <div class="skeleton h-4 w-28"></div>
    </div>
  </div>
  <div class="skeleton h-32 w-full"></div>
</div>
div(
  [
    div(
      [
        div(const [], classes: 'skeleton h-16 w-16 shrink-0 rounded-full'),
        div(
          [
            div(const [], classes: 'skeleton h-4 w-20'),
            div(const [], classes: 'skeleton h-4 w-28'),
          ],
          classes: 'flex flex-col gap-4',
        ),
      ],
      classes: 'flex items-center gap-4',
    ),
    div(const [], classes: 'skeleton h-32 w-full'),
  ],
  classes: 'flex w-52 flex-col gap-4',
);

Skeleton - rectangle with content

<div class="flex w-52 flex-col gap-4">
  <div class="skeleton h-32 w-full"></div>
  <div class="skeleton h-4 w-28"></div>
  <div class="skeleton h-4 w-full"></div>
  <div class="skeleton h-4 w-full"></div>
</div>
div(
  [
    div(const [], classes: 'skeleton h-32 w-full'),
    div(const [], classes: 'skeleton h-4 w-28'),
    div(const [], classes: 'skeleton h-4 w-full'),
    div(const [], classes: 'skeleton h-4 w-full'),
  ],
  classes: 'flex w-52 flex-col gap-4',
);

skeleton-text - animated gradient text

AI is thinking harder...
<span class="skeleton skeleton-text">AI is thinking harder...</span>
Skeleton([Component.text('AI is thinking harder...')], modifier: SkeletonModifier.text);