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

    117
  • Klyv Animated Beam

    Klyv Animated Beam

    76
  • Shader Canvas

    Shader Canvas

    75
  • Pareto Chart

    Pareto Chart

    65
  • Fluid Canvas

    Fluid Canvas

    48
  • Time Slot Picker

    Time Slot Picker

    41
  • Sunburst Chart

    Sunburst Chart

    37
  • Klyv Border Beam

    Klyv Border Beam

    33

More in Cards

View all
  • Stats cards with links

    Stats cards with links

    46
  • Course Design Cards

    Course Design Cards

    1.3K
  • Liquid Glass Card

    Liquid Glass Card

    202
  • Statistics Card 2

    Statistics Card 2

    321
  • Card Studio

    Card Studio

    37
  • Astryx Clickable Card

    Astryx Clickable Card

    1
  • Admin Dashboard Cards

    Admin Dashboard Cards

    40
  • Statistics Card 10

    Statistics Card 10

    307