$npx @dinachi/cli@latest add load-transition
main → production
41 seconds ago
14
files
41s
build
3
packages
All 6 checks passed
loadingdelayminimumradiusdeploy-status.tsx
import { LoadTransition } from "@/components/ui/load-transition"
function DeploySkeleton() {
return (
<div className="space-y-3">
<div className="h-9 w-48 animate-pulse rounded bg-muted" />
<div className="h-12 animate-pulse rounded-lg bg-muted" />
</div>
)
}
export function DeployStatus({ loading }: { loading: boolean }) {
return (
<LoadTransition
loading={loading}
skeleton={<DeploySkeleton />}
>
<div className="space-y-3">
<p className="text-sm font-medium">main → production</p>
<p className="text-xs text-muted-foreground">All 6 checks passed</p>
</div>
</LoadTransition>
)
}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
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>
);
}120msidle
1,284
requests / min
1200msidle
1,284
requests / min
Two loads, and only the slow one shows a skeleton.
// Nothing shows for the first 180ms, so a request that returns in 120ms goes
// straight to content. Once shown, the skeleton is held 420ms so it cannot flash.
<LoadTransition loading={isLoading} skeleton={<Placeholder />} delay={180} minimum={420}>
<Metric value={data.rpm} />
</LoadTransition>
// The hook behind that is exported, if you need to know whether a skeleton is up —
// for a test, or to report the fast path where nothing visible happens at all.
const skeletonVisible = useSkeletonVisibility(isLoading, 180, 420);94 deploys
The panel styling is a default, not a requirement.
// radius is a number in px, applied inline: motion can only correct the distortion
// its own scale introduces on a value it is animating, and a class is invisible to it.
<LoadTransition
loading={isLoading}
skeleton={<div className="h-6 w-28 animate-pulse rounded bg-muted" />}
className="border-0 bg-transparent p-0"
radius={0}
>
<p className="text-xl font-semibold">94 deploys</p>
</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
delayshows 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.loadingboolean
Whether data is still loading.delaynumber = 180
Milliseconds before it turns true.minimumnumber = 420
Milliseconds it stays true once on.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.