Primitives
Skeleton
Loading placeholder with a Motion shimmer that stops under reduced motion.
Motioninfinite gradient sweep; halts via reduced motion
Install
Install Kineto and follow the theme setup once in your app.
bash
npm install kinetotsx
import { Skeleton } from "kineto/skeleton";Preview
tsx
"use client";
import * as React from "react";
import { motion, useReducedMotion } from "motion/react";
import { cn } from "@/lib/cn";
export type SkeletonProps = React.HTMLAttributes<HTMLDivElement>;
const Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(
({ className, ...props }, ref) => {
const reduced = useReducedMotion();
return (
<div
ref={ref}
className={cn("relative overflow-hidden rounded-md bg-muted", className)}
{...props}
>
{!reduced ? (
<motion.div
className="absolute inset-0 bg-gradient-to-r from-transparent via-foreground/10 to-transparent"
initial={{ x: "-100%" }}
animate={{ x: "100%" }}
transition={{ duration: 1.5, ease: "linear", repeat: Infinity }}
/>
) : null}
</div>
);
}
);
Skeleton.displayName = "Skeleton";
export { Skeleton };src/components/ui/skeleton.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | HTMLAttributes<div> | — | Size it with className (h-/w-/rounded-). |