Skip to content

Skeleton card

Cards
Skeleton card
Loading state
Skeleton

Card showing a skeleton loading state with avatar placeholder, text rows, and a content block.

card ยท skeleton
import { Card, CardHeader, CardDescription, CardTitle, CardContent } from "@/components/ui/card"
import { Stack } from "@/components/ui/stack"
import { Skeleton } from "@/components/ui/skeleton"

export function SkeletonCard() {
  return (
    <Card>
      <CardHeader>
        <CardDescription>Loading state</CardDescription>
        <CardTitle>Skeleton</CardTitle>
      </CardHeader>
      <CardContent>
        <Stack direction="col" gap="3">
          <Stack direction="row" gap="3" align="center">
            <Skeleton className="size-9 rounded-full shrink-0" />
            <Stack direction="col" gap="1" className="flex-1">
              <Skeleton className="h-3 w-3/4" />
              <Skeleton className="h-3 w-1/2" />
            </Stack>
          </Stack>
          <Skeleton className="h-3 w-full" />
          <Skeleton className="h-3 w-5/6" />
          <Skeleton className="h-20 w-full rounded-md" />
        </Stack>
      </CardContent>
    </Card>
  )
}
ui26/react
<script lang="ts">
  import Card from "$lib/components/ui/card.svelte"
  import CardHeader from "$lib/components/ui/card-header.svelte"
  import CardDescription from "$lib/components/ui/card-description.svelte"
  import CardTitle from "$lib/components/ui/card-title.svelte"
  import CardContent from "$lib/components/ui/card-content.svelte"
  import Stack from "$lib/components/ui/stack.svelte"
  import Skeleton from "$lib/components/ui/skeleton.svelte"
</script>

<Card>
  <CardHeader>
    <CardDescription>Loading state</CardDescription>
    <CardTitle>Skeleton</CardTitle>
  </CardHeader>
  <CardContent>
    <Stack direction="col" gap="3">
      <Stack direction="row" gap="3" align="center">
        <Skeleton class="size-9 rounded-full shrink-0" />
        <Stack direction="col" gap="1" class="flex-1">
          <Skeleton class="h-3 w-3/4" />
          <Skeleton class="h-3 w-1/2" />
        </Stack>
      </Stack>
      <Skeleton class="h-3 w-full" />
      <Skeleton class="h-3 w-5/6" />
      <Skeleton class="h-20 w-full rounded-md" />
    </Stack>
  </CardContent>
</Card>
ui26/svelte
---
import Card from "@/components/ui/card.astro"
import CardHeader from "@/components/ui/card-header.astro"
import CardDescription from "@/components/ui/card-description.astro"
import CardTitle from "@/components/ui/card-title.astro"
import CardContent from "@/components/ui/card-content.astro"
import Stack from "@/components/ui/stack.astro"
import Skeleton from "@/components/ui/skeleton.astro"
---

<Card>
  <CardHeader>
    <CardDescription>Loading state</CardDescription>
    <CardTitle>Skeleton</CardTitle>
  </CardHeader>
  <CardContent>
    <Stack direction="col" gap="3">
      <Stack direction="row" gap="3" align="center">
        <Skeleton class="size-9 rounded-full shrink-0" />
        <Stack direction="col" gap="1" class="flex-1">
          <Skeleton class="h-3 w-3/4" />
          <Skeleton class="h-3 w-1/2" />
        </Stack>
      </Stack>
      <Skeleton class="h-3 w-full" />
      <Skeleton class="h-3 w-5/6" />
      <Skeleton class="h-20 w-full rounded-md" />
    </Stack>
  </CardContent>
</Card>
ui26/astro
{
  "root": "card",
  "elements": {
    "card": {
      "type": "Card",
      "props": {},
      "children": [
        "hdr",
        "content"
      ]
    },
    "hdr": {
      "type": "CardHeader",
      "props": {},
      "children": [
        "desc",
        "title"
      ]
    },
    "desc": {
      "type": "CardDescription",
      "props": {
        "text": "Loading state"
      },
      "children": []
    },
    "title": {
      "type": "CardTitle",
      "props": {
        "text": "Skeleton"
      },
      "children": []
    },
    "content": {
      "type": "CardContent",
      "props": {},
      "children": [
        "body"
      ]
    },
    "body": {
      "type": "Stack",
      "props": {
        "direction": "col",
        "gap": "3"
      },
      "children": [
        "row",
        "line1",
        "line2",
        "block"
      ]
    },
    "row": {
      "type": "Stack",
      "props": {
        "direction": "row",
        "gap": "3",
        "align": "center"
      },
      "children": [
        "avatar-skel",
        "text-group"
      ]
    },
    "avatar-skel": {
      "type": "Skeleton",
      "props": {
        "className": "size-9 rounded-full shrink-0"
      },
      "children": []
    },
    "text-group": {
      "type": "Stack",
      "props": {
        "direction": "col",
        "gap": "1",
        "className": "flex-1"
      },
      "children": [
        "name-skel",
        "role-skel"
      ]
    },
    "name-skel": {
      "type": "Skeleton",
      "props": {
        "className": "h-3 w-3/4"
      },
      "children": []
    },
    "role-skel": {
      "type": "Skeleton",
      "props": {
        "className": "h-3 w-1/2"
      },
      "children": []
    },
    "line1": {
      "type": "Skeleton",
      "props": {
        "className": "h-3 w-full"
      },
      "children": []
    },
    "line2": {
      "type": "Skeleton",
      "props": {
        "className": "h-3 w-5/6"
      },
      "children": []
    },
    "block": {
      "type": "Skeleton",
      "props": {
        "className": "h-20 w-full rounded-md"
      },
      "children": []
    }
  }
}
ui26/json-render