Skeleton

A pulsing block that holds a piece of content's place while it loads, drawn to its size with a className and to its corners with borderRadius.

import { Skeleton } from "@produkto/ui/Skeleton";

const Example = () => (
  <div className="flex items-center gap-4">
    <Skeleton className="size-12" borderRadius="full" />
    <div className="flex flex-col gap-2">
      <Skeleton className="h-4 w-62.5" />
      <Skeleton className="h-4 w-50" />
    </div>
  </div>
);

export default Example;

Usage

import { Skeleton } from "@produkto/ui/Skeleton";
<Skeleton className="h-5 w-25" borderRadius="full" />

Examples

Border radius

borderRadius sets its corners on the kit's one scale to match what it holds the place of: none, xs 4px, sm 6px (the default), base 8px, lg 12px, xl 16px, or full to round it, as an avatar's place takes.

import { Label } from "@produkto/ui/Label";
import {
  Skeleton,
  type SkeletonBorderRadius,
} from "@produkto/ui/Skeleton";

const variants: { borderRadius: SkeletonBorderRadius; label: string }[] = [
  { borderRadius: "none", label: "None" },
  { borderRadius: "xs", label: "xs" },
  { borderRadius: "sm", label: "sm" },
  { borderRadius: "base", label: "base" },
  { borderRadius: "lg", label: "lg" },
  { borderRadius: "xl", label: "xl" },
  { borderRadius: "full", label: "full" },
];

const Example = () => (
  <div className="flex flex-wrap items-start gap-6">
    {variants.map((variant) => (
      <div
        className="flex flex-col items-center gap-2"
        key={variant.borderRadius}
      >
        <Label>{variant.label}</Label>
        <Skeleton className="size-12" borderRadius={variant.borderRadius} />
      </div>
    ))}
  </div>
);

export default Example;

With icon

SkeletonRow holds the place of a list's or a menu's row, a line at the row's height, and icon sets a square before it where the row's icon will be, beside a row without one as it is by default.

import { SkeletonRow } from "@produkto/ui/Skeleton";

const Example = () => (
  <div className="flex w-full max-w-xs flex-col gap-2">
    <SkeletonRow />
    <SkeletonRow icon />
  </div>
);

export default Example;

API Reference

Skeleton

SkeletonProps · components/Skeleton/Skeleton.types.ts
PropTypeDefault
borderRadiusSkeletonBorderRadius"none" | "xs" | "sm" | "base" | "lg" | "xl" | "full""sm"

SkeletonRow

SkeletonRowProps · also takes the props of <div>
PropTypeDefault
iconbooleanfalse

It also takes the props of <div>.