Skip to content
Klarhimmel UI

Skeleton

npx shadcn add @klarhimmel/skeleton

Examples

  • Card

  • List

  • Text

DetailsAbout, usage, props and more

A pulsing placeholder for content that is on its way. It stops pulsing when motion is reduced.

When to use

  • Use for

    Content that loads in a moment, shaped like what will replace it.

  • Not for

    Long jobs. Show progress and say what is happening.

  • Pairs with

    Card, lists, SkeletonText for paragraphs.

Preview

skeleton.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { Skeleton, SkeletonText } from '@/components/klarhimmel/ui/skeleton';

export default function Example() {
  return (
    <Theme theme="brand">
      <Skeleton className="h-6 w-1/2" />
      <SkeletonText lines={3} label="Loading the review" />
    </Theme>
  );
}

Import

Import

import { Skeleton, SkeletonText } from '@/components/klarhimmel/ui/skeleton';
Files
skeleton.tsx, in components/klarhimmel/ui/. With it: theme, utils.
Render in
Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.

Props

PropTypeDefaultDescription
Skeleton.classNamestring-Size it with width and height classes (Skeleton).
SkeletonText.linesnumber3Number of lines; the last is shorter (SkeletonText).
SkeletonText.labelstring'Loading'What is announced once for the group (SkeletonText).
SkeletonText.classNamestring-Size it with width and height classes (Skeleton).

Accessibility

KeyDoes
TabSkips it: a skeleton is not interactive
Screen readerA single block is hidden. SkeletonText announces its label once, as a status

Not interactive. Give the group a visible or spoken label (SkeletonText label) and do not leave skeletons on screen for long.

Accessibility