Skeleton

A redacted placeholder for loading content.

content

Apple: Redacted placeholders

· Base UI: element

Loading row

import { Skeleton } from "@applecn/ui/components/skeleton"

export default function SkeletonBasic() {
  return (
    <div className="flex max-w-sm items-center gap-3 rounded-4xl bg-card p-4">
      <Skeleton className="size-10 rounded-full" />
      <div className="flex flex-1 flex-col gap-2">
        <Skeleton className="h-4 w-1/2" />
        <Skeleton className="h-3 w-3/4" />
      </div>
    </div>
  )
}

Install

From the registry this site publishes, with dependencies resolved by the CLI.

npx shadcn@latest add https://applecn.vercel.app/r/skeleton.json

Source

packages/ui/src/components/skeleton.tsx

import { cn } from "cn"
import type { ComponentProps } from "react"

/** A redacted placeholder for content that is still loading; still under reduced motion. */
function Skeleton({ className, ...props }: ComponentProps<"div">) {
  return (
    <div
      data-slot="skeleton"
      aria-hidden="true"
      className={cn(
        "animate-pulse rounded-md bg-fill-3 motion-reduce:animate-none",
        className
      )}
      {...props}
    />
  )
}

export { Skeleton }