{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "skeleton",
  "type": "registry:ui",
  "title": "Skeleton",
  "description": "A pulsing block that stands in for content that is loading: a bare block sized by hand, lines of text, or a wrapper that takes the exact size of the real content. It is still under reduced motion.",
  "categories": [
    "ui"
  ],
  "dependencies": [],
  "registryDependencies": [
    "@rivier-ui/theme",
    "@rivier-ui/cn"
  ],
  "files": [
    {
      "path": "registry/ui/skeleton.tsx",
      "type": "registry:ui",
      "target": "components/ui/skeleton.tsx",
      "content": "/**\n * @name skeleton\n * @category ui\n * @description A pulsing block that stands in for content that is loading: a bare block sized by hand, lines of text, or a wrapper that takes the exact size of the real content. It is still under reduced motion.\n * @when Content whose shape is known is on its way. Nothing may jump when it arrives: either size the block like the thing it replaces, or wrap the real component (rendered with placeholder data) in `<Skeleton loading>` so the box is exactly its final size. Mark the region that is loading with `aria-busy=\"true\"`: the placeholders themselves are hidden from assistive technology. For an unknown wait use spinner; for a measurable one use progress.\n * @example\n * <div className=\"flex items-center gap-3\" aria-busy=\"true\">\n *   <Skeleton className=\"size-10 rounded-full\" />\n *   <SkeletonText lines={2} className=\"flex-1\" />\n * </div>\n *\n * // Holds the final size: the card is laid out, invisible and inert, under the placeholder\n * <section aria-busy={isLoading}>\n *   <Skeleton loading={isLoading}>\n *     <PriceCard price={price ?? PLACEHOLDER_PRICE} />\n *   </Skeleton>\n * </section>\n */\nimport type { ComponentProps } from \"react\";\nimport { cn } from \"@/lib/cn\";\n\nconst PLACEHOLDER = \"animate-pulse rounded-control bg-muted motion-reduce:animate-none\";\n\nexport type SkeletonProps = ComponentProps<\"div\"> & {\n  /**\n   * With children: true shows the placeholder over the children, which are laid out but invisible and\n   * inert (no focus, no clicks, not read); false shows the children. Without children it has no effect.\n   */\n  loading?: boolean;\n};\n\n/**\n * Without children: a block, `h-4 w-full` unless sized with classes. With children: a box of exactly the\n * children's size. The children stay mounted when loading ends, so nothing is built twice and nothing\n * shifts. Hidden from assistive technology while it is a placeholder.\n */\nexport function Skeleton({ className, loading = true, children, ...props }: SkeletonProps) {\n  if (children === undefined || children === null) {\n    return <div data-slot=\"skeleton\" aria-hidden=\"true\" className={cn(\"h-4 w-full\", PLACEHOLDER, className)} {...props} />;\n  }\n  return (\n    <div data-slot=\"skeleton\" data-loading={loading ? \"\" : undefined} aria-hidden={loading ? \"true\" : undefined} className={loading ? cn(PLACEHOLDER, className) : \"contents\"} {...props}>\n      <div data-slot=\"skeleton-content\" inert={loading} className={loading ? \"invisible\" : \"contents\"}>\n        {children}\n      </div>\n    </div>\n  );\n}\n\nexport type SkeletonTextProps = ComponentProps<\"div\"> & {\n  /** How many lines. Default 3. The last is shorter, as the last line of a paragraph is. */\n  lines?: number;\n};\n\n/** Lines of text to come. Each line is the height of a line of `text-sm`; set `gap-*` and line classes to match other sizes. */\nexport function SkeletonText({ className, lines = 3, ...props }: SkeletonTextProps) {\n  return (\n    <div data-slot=\"skeleton-text\" aria-hidden=\"true\" className={cn(\"flex w-full flex-col gap-2\", className)} {...props}>\n      {Array.from({ length: Math.max(1, lines) }, (_, index) => (\n        <div key={index} data-slot=\"skeleton-line\" className={cn(\"h-4\", PLACEHOLDER, index === lines - 1 && lines > 1 ? \"w-2/3\" : \"w-full\")} />\n      ))}\n    </div>\n  );\n}\n"
    }
  ],
  "meta": {
    "category": "ui",
    "when": "Content whose shape is known is on its way. Nothing may jump when it arrives: either size the block like the thing it replaces, or wrap the real component (rendered with placeholder data) in `<Skeleton loading>` so the box is exactly its final size. Mark the region that is loading with `aria-busy=\"true\"`: the placeholders themselves are hidden from assistive technology. For an unknown wait use spinner; for a measurable one use progress.",
    "example": "<div className=\"flex items-center gap-3\" aria-busy=\"true\">\n  <Skeleton className=\"size-10 rounded-full\" />\n  <SkeletonText lines={2} className=\"flex-1\" />\n</div>\n\n// Holds the final size: the card is laid out, invisible and inert, under the placeholder\n<section aria-busy={isLoading}>\n  <Skeleton loading={isLoading}>\n    <PriceCard price={price ?? PLACEHOLDER_PRICE} />\n  </Skeleton>\n</section>",
    "client": false
  }
}
