Skip to content

Skeleton

A placeholder shape while content loads.

View as Markdown

Example

Installation

npx fizzy-ui add skeleton

Copies skeleton.ts into src/app/ui/ and installs what it needs. Run init once first.

Accessibility

No axe-core violations axe-core 4.14.0 checks this example, closed and with its panels open, on every build; the site is not published otherwise.

  • Wrap the placeholders in role="status" aria-busy="true" with a label.

Source

The exact file add copies. It is yours to edit.

skeleton.ts
import { Directive } from '@angular/core';

/** Purely visual. Put `aria-busy="true"` on the region that is loading. */
@Directive({
  selector: '[fzSkeleton]',
  host: { 'aria-hidden': 'true', class: 'block animate-pulse rounded-md bg-muted' },
})
export class FzSkeleton {}

export const FZ_SKELETON = [FzSkeleton] as const;