Skeleton
A placeholder representing content while it loads.
- Chromium
- Firefox
- WebKit
- WCAG 2.2 AA
Preview
import { Skeleton } from "@moe-ui/registry/components/ui/skeleton";
import { View } from "react-native";
export default function SkeletonPreview() {
return (
<View className="flex-row items-center gap-4">
<Skeleton className="h-12 w-12 rounded-full" />
<View className="gap-2">
<Skeleton className="h-4 w-[250px]" />
<Skeleton className="h-4 w-[200px]" />
</View>
</View>
);
}
One command, your source
Installation
pnpm dlx @moe-ui/cli@beta add skeletonUsage
The CLI installs editable source into your application. Import the component from your configured UI directory:
import { Skeleton } from "@/components/ui/skeleton";Variants and composition
Compound parts and variants remain regular source in your project, so you can change them without wrapping a package API.
Public API
The canonical source panel below lists every public export, dependency, and the complete implementation shipped by the registry.
Keyboard and accessibility
Status is not communicated by color alone. Add an accessible label or live-region behavior when the message changes dynamically.
Browser support
This beta is release-tested in Chromium, Firefox, and WebKit in light and dark themes. See the web compatibility matrix for the current gate.
Nothing hiddenCanonical source and public exports1 exports
Skeleton"use client";
import { cn } from "../../lib/utils";
import { View } from "react-native";
import Animated, {
useAnimatedStyle,
useSharedValue,
withRepeat,
withTiming,
} from "react-native-reanimated";
import * as React from "react";
const duration = 1000;
function Skeleton({
className,
...props
}: React.ComponentProps<typeof View> & React.RefAttributes<View>) {
const sv = useSharedValue(1);
React.useEffect(() => {
sv.value = withRepeat(withTiming(0.5, { duration }), -1, true);
}, [sv]);
const style = useAnimatedStyle(
() => ({
opacity: sv.value,
}),
[sv],
);
return (
<Animated.View
style={style}
className={cn("bg-secondary dark:bg-muted rounded-md", className)}
{...props}
/>
);
}
export { Skeleton };