Skeleton thumbnail
A square placeholder that reserves the space for a product image while it loads, in extra small through large sizes.
Preview
Code
Example.jsx
import { Card, Box, BlockStack, InlineStack, SkeletonThumbnail, SkeletonBodyText, SkeletonDisplayText, Divider } from '@shopify/polaris';
const PRODUCT_ROWS = ['scarf', 'mug', 'lamp'];
const SIZE_EXAMPLES = [
{ id: 'extraSmall', size: 'extraSmall', label: 'Extra small' },
{ id: 'small', size: 'small', label: 'Small' },
{ id: 'medium', size: 'medium', label: 'Medium' },
{ id: 'large', size: 'large', label: 'Large' },
];
export const Example = () => (
<BlockStack gap="400">
<Card padding="0">
<Box padding="400">
<SkeletonDisplayText size="small" />
</Box>
<Divider />
{PRODUCT_ROWS.map((row, index) => (
<BlockStack key={row} gap="0">
{index > 0 && <Divider />}
<Box padding="400">
<InlineStack gap="400" blockAlign="center" wrap={false}>
<SkeletonThumbnail size="medium" />
<Box width="100%">
<SkeletonBodyText lines={2} />
</Box>
</InlineStack>
</Box>
</BlockStack>
))}
</Card>
<Card>
<InlineStack gap="400" blockAlign="center">
{SIZE_EXAMPLES.map((item) => (
<SkeletonThumbnail key={item.id} size={item.size} />
))}
</InlineStack>
</Card>
</BlockStack>
);