For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /dolan/skeleton.md.

Skeleton

Hold the place of content that's still loading with a muted, pulsing block shaped like it.

Installation

npx @blotch/dolan add skeleton
import { UiSkeleton } from '../components/ui/skeleton';

Usage

import { Component } from '@angular/core';
import { UiSkeleton } from '../components/ui/skeleton';

@Component({
  selector: 'app-loading-line',
  imports: [UiSkeleton],
  template: `<ui-skeleton class="h-4 w-full" />`,
})
export class LoadingLine {}
  • The skeleton has no size of its own. Give it a width and height with classes.
  • It's rounded-md by default. Add rounded-full for a circle.
  • It pulses for as long as it's on screen, and keeps pulsing while your app is busy: the platform runs the pulse, Core Animation on iOS and Android's animators. So animate() on the skeleton itself does nothing on iOS or Android: to fade or move one, wrap it in a <view> and animate that.

Card layout

Compose several skeletons to match the shape of the content you're loading. Swap them for the real content with @if once it arrives.

<view class="flex flex-col gap-4">
  <view class="flex flex-row items-center gap-3">
    <ui-skeleton class="h-10 w-10 rounded-full" />
    <view class="flex flex-1 flex-col gap-2">
      <ui-skeleton class="h-4 w-3/4" />
      <ui-skeleton class="h-3 w-1/2" />
    </view>
  </view>
  <ui-skeleton class="h-48 w-full" />
</view>

This template uses <view>, so its component imports LYNX_ELEMENTS from @blotch/angular-lynx.

API

UiSkeleton

InputTypeDefaultDescription
classstring''Size, shape and any other classes.

No outputs.

  • Avatar: uses a skeleton while its photo loads
  • Spinner: show loading without a placeholder shape
  • Progress: show how far a task has got