Skip to main content

Skeleton

Skeleton is a loading placeholder with a shimmer animation. Use it to show content structure while data is loading.

Open in Storybook

Import

import { Skeleton } from "@tosui/react";

Basic Usage

Sizes

Rounded Variants

Loaded State

Use isLoaded to show content when loading is complete.

function UserCard({ isLoading, user }) {
return (
<HStack gap={4}>
<Skeleton w="48px" h="48px" rounded="full" isLoaded={!isLoading}>
<Avatar src={user.avatar} name={user.name} />
</Skeleton>
<VStack align="flex-start" gap={2}>
<Skeleton w="120px" h="16px" isLoaded={!isLoading}>
<Text fontWeight="medium">{user.name}</Text>
</Skeleton>
<Skeleton w="80px" h="12px" isLoaded={!isLoading}>
<Text fontSize="sm" color="foreground-muted">{user.role}</Text>
</Skeleton>
</VStack>
</HStack>
);
}

Common Patterns

Card Skeleton

List Skeleton

Text Block

Props Reference

PropTypeDefaultDescription
wstring-Width (CSS value)
hstring-Height (CSS value)
rounded"none" | "sm" | "md" | "lg" | "full""md"Border radius
isLoadedbooleanfalseWhen true, renders children instead of skeleton
childrenReactNode-Content to show when loaded

Accessibility

  • Has aria-hidden="true" since it's decorative
  • When isLoaded is true, only children are rendered

TypeScript

import { Skeleton, type SkeletonProps } from "@tosui/react";