Load Transition

Animated

Swaps a skeleton for content without a height jump.

Source
$npx @dinachi/cli@latest add load-transition

main → production

41 seconds ago

Passed

14

files

41s

build

3

packages

All 6 checks passed
loading
delay
minimum
radius

Usage

import { LoadTransition } from "@/components/ui/load-transition"

export function Summary({ data, isLoading }) {
  return (
    <LoadTransition loading={isLoading} skeleton={<SummarySkeleton />}>
      <DeploymentSummary data={data} />
    </LoadTransition>
  )
}

Examples

main → production

41 seconds ago

Passed

14

files

41s

build

3

packages

All 6 checks passed
Everything below rides the resize
The card is taller than its skeleton, and nothing jumps.
import { LoadTransition } from '@/components/ui/load-transition';

export function Example() {
  const { data, isLoading } = useDeployment();

  // The skeleton mirrors the card's shape, not its height — real content is almost
  // always taller. The panel animates the difference so the page below rides it.
  return (
    <LoadTransition loading={isLoading} skeleton={<DeploySkeleton />}>
      <DeployCard data={data} />
    </LoadTransition>
  );
}

Notes

Motion tier

Needs motion. add --all skips it; install with add --motion or by name.

Behaviour

  • The panel animates its height across the swap, so content below does not jump.
  • The skeleton fades out in 120ms; content fades in over 260ms.
  • A load shorter than delay shows no skeleton.
  • Once shown, the skeleton stays for minimum.

Radius

Set corners with radius, not a class. A class radius stretches during the resize.

When to use it

  • A region whose loaded height differs from its placeholder: a summary, a card, a detail panel.
  • Skip it for full-page loads and for content that streams in piece by piece; it swaps once.

API

loadingboolean
Whether data is still loading. The skeleton follows the thresholds.
skeletonReactNode
The placeholder shown while waiting.
childrenReactNode
The loaded content.
delaynumber = 180
Milliseconds of loading before the skeleton appears.
minimumnumber = 420
Milliseconds the skeleton stays once shown.
radiusnumber = 12
Corner radius in px, applied inline. See Radius.
classNamestring
Merged over the panel's border, background and padding.

Accessibility

  • Skeleton and content render as given. Mark a meaningless skeleton aria-hidden or give it a busy label.
  • Reduced motion makes the resize, travel and crossfade instant; thresholds still apply.