Skeleton

Markdown

A placeholder component used to indicate loading state before content is available.

<Flex gap="4" wrap="wrap" align="center" justify="center" className="w-full">
  <Skeleton variant="pulse" style={{ width: 200, height: 24 }} />
</Flex>

Anatomy

<Skeleton />

Examples

Variants

Skeleton components come with three built-in variants: solid, pulse, and shimmer.

solid

pulse

shimmer

<Flex
  gap="4"
  wrap="wrap"
  align="center"
  justify="center"
  className="w-full"
  direction="column"
>
  {["solid", "pulse", "shimmer"].map((variant) => (
    <Grid key={variant} columns="2">
      <Text>{variant}</Text>
      <Skeleton variant={variant} style={{ width: 200, height: 24 }} />
    </Grid>
  ))}
</Flex>

Loading State

Use the loading prop to toggle between the skeleton and its children. When loading is false, the children are rendered instead of the skeleton placeholder.

Loading

This is the content

Loaded

This is the content

<Flex gap="4" wrap="wrap" align="center" justify="center" className="w-full">
  <Grid columns="2" gap="2">
    <Text>Loading</Text>
    <Skeleton loading={true} variant="pulse">
      <Text>This is the content</Text>
    </Skeleton>

    <Text>Loaded</Text>
    <Skeleton loading={false} variant="pulse">
      <Text>This is the content</Text>
    </Skeleton>
  </Grid>
</Flex>

Composition

Skeletons can be composed to represent more complex loading layouts.

<Flex gap="4" wrap="wrap" align="center" justify="center" className="w-full">
  <Flex direction="column" gap="2">
    <Skeleton variant="pulse" style={{ width: 120, height: 12 }} />
    <Skeleton variant="pulse" style={{ width: 200, height: 12 }} />
    <Skeleton variant="pulse" style={{ width: 160, height: 12 }} />
  </Flex>
</Flex>