import { Skeleton, Text } from "@vortexlabs/vortex-native";
<Skeleton
loading
animation="pulse"
borderRadius="md"
type="block"
>
<Text>Delivery tomorrow</Text>
</Skeleton>Features
- Draws placeholder blocks, surfaces, and lines of text.
- Takes its dimensions from content when you pass children.
- Shares loading state and animation across a group of placeholders.
Anatomy
<Skeleton.Group loading={loading}>
<Skeleton width={48} height={48} />
<Skeleton.Text width="65%" />
</Skeleton.Group>Blocks and Surfaces
Use the default block for solid shapes. Set type="surface" with a placeholder to draw a lighter card with individual shapes on top. Put the content to reveal after loading in children.
import { Skeleton, Stack } from "@vortexlabs/vortex-native";
export const SkeletonBlocks = () => (
<Stack gap={4} width={300} maxWidth="100%">
<Skeleton height={80} borderRadius="md" />
<Skeleton
type="surface"
borderRadius="lg"
style={{ padding: 16 }}
placeholder={
<Stack gap={3}>
<Skeleton width={40} height={40} />
<Skeleton.Text width="70%" />
<Skeleton.Text width="45%" />
</Stack>
}
/>
</Stack>
);Text
Use Skeleton.Text for one line. Pass the expected text to match its width, or set width when the text is unknown. Each size matches the corresponding body text size.
import { Skeleton, Stack } from "@vortexlabs/vortex-native";
export const SkeletonTextLines = () => (
<Stack gap={3} width={300} maxWidth="100%" align="start">
<Skeleton.Text size="lg">Order summary</Skeleton.Text>
<Skeleton.Text size="md" width="80%" />
<Skeleton.Text size="sm" width="55%" />
</Stack>
);Animation
Choose pulse, shimmer, or none. A group applies the same animation to its placeholders. Use stagger to reveal the shapes in sequence.
import { Skeleton, Stack, Text } from "@vortexlabs/vortex-native";
export const SkeletonAnimations = () => (
<Stack gap={3} width={300} maxWidth="100%">
<Text size="body-sm">Pulse</Text>
<Skeleton height={16} animation="pulse" />
<Text size="body-sm">Shimmer</Text>
<Skeleton height={16} animation="shimmer" />
<Text size="body-sm">Static</Text>
<Skeleton height={16} animation="none" />
</Stack>
);Automatic Placeholders
Wrap content in Skeleton.Group to switch its supported components between placeholders and loaded content together. It supports Avatar, Badge, Button, Image, and Text.
import { Avatar, Badge, Button, Skeleton, Stack, Switch, Text } from "@vortexlabs/vortex-native";
import React from "react";
export const SkeletonProfile = () => {
const [loading, setLoading] = React.useState(true);
return (
<Stack gap={4} width={300} maxWidth="100%">
<Switch checked={loading} onChange={({ checked }) => setLoading(checked)}>
Loading member profile
</Switch>
<Skeleton.Group loading={loading} animation="shimmer" stagger ariaLabel="Loading member profile">
<Stack gap={3} align="start">
<Stack direction="row" gap={3} align="center">
<Avatar initials="AL" />
<Text weight="semibold">Alex Lee</Text>
</Stack>
<Badge tone="success">On the team</Badge>
<Button variant="secondary" onPress={() => setLoading(true)}>Refresh profile</Button>
</Stack>
</Skeleton.Group>
</Stack>
);
};Accessibility
ariaLabel on Skeleton.Group to describe what is loading, such as “Loading member profile”. Individual shapes in the group are hidden from screen readers.ariaLabel when it is the only loading indicator for that content.