klyv-ui

Loading Overlay

Cards

About

A scrim with a spinner that covers a relatively-positioned container while it is busy, without shifting the layout underneath.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Loading Overlay to your project and fits it to your theme.

Code

How Loading Overlay is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { LoadingOverlay } from "@/components/ui/loading-overlay";
import { useState } from "react";

export default function LoadingOverlayDemo() {
  const [active, setActive] = useState(true);

  return (
    <div className="flex w-full h-full items-center justify-center bg-background p-6">
      <div className="flex w-full max-w-sm flex-col items-center gap-4">
        <div
          aria-busy={active}
          className="relative w-full rounded-[var(--radius-card)] border border-line bg-surface p-5 shadow-[var(--shadow-card)]"
        >
          <p className="text-[13px] font-bold text-ink">Exchange Money</p>
          <div className="mt-4 flex flex-col gap-3">
            <div className="flex items-center justify-between">
              <span className="text-[12px] font-medium text-ink-soft">
                From
              </span>
              <span className="text-[13px] font-bold text-ink">$ 500</span>
            </div>
            <div className="flex items-center justify-between">
              <span className="text-[12px] font-medium text-ink-soft">
                Currency rate
              </span>
              <span className="text-[13px] font-bold text-ink">
                1 USD = 0,73 GBP
              </span>
            </div>
          </div>
          <LoadingOverlay
            active={active}
            label="Fetching the latest rate"
            showLabel
            blur
          />
        </div>
        <button
          type="button"
          onClick={() => setActive((prev) => !prev)}
          className="inline-flex h-9 items-center justify-center rounded-full bg-accent px-4 text-[13px] font-semibold text-accent-ink transition-colors hover:bg-accent-strong"
        >
          {active ? "Finish loading" : "Start loading"}
        </button>
      </div>
    </div>
  );
}

More by klyv-ui

View all
  • Gantt Chart

    Gantt Chart

    101
  • Shader Canvas

    Shader Canvas

    66
  • Klyv Animated Beam

    Klyv Animated Beam

    65
  • Pareto Chart

    Pareto Chart

    59
  • Fluid Canvas

    Fluid Canvas

    43
  • Sunburst Chart

    Sunburst Chart

    35
  • Morphing Text

    Morphing Text

    32
  • Time Slot Picker

    Time Slot Picker

    29

More in Cards

View all
  • Course Design Cards

    Course Design Cards

    1.3K
  • Stats cards with links

    Stats cards with links

    97
  • Statistics Card 7

    Statistics Card 7

    334
  • Photo Deck

    Photo Deck

    23
  • Interactive Tech Stack Bento Grid with Hover Effects

    Interactive Tech Stack Bento Grid with Hover Effects

    675
  • Approval Card

    Approval Card

    33
  • Edge Cluster Status Card

    Edge Cluster Status Card

  • Card

    Card

    73