ReactHive

Card Deal

Features 20

About

Cards dealt into a grid on the wind. As you scroll, each card rises from a lower corner nearly edge on, curled like a sheet of paper, then untwists and flattens into its cell as the next one lands. A light behind the grid grows with every card and glows through the gaps.

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

Code

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

Usage.tsx

"use client";

import type { ReactNode } from "react";

import { CardDeal, type DealCard } from "@/components/ui/card-deal";

const settings = {
  tint: "#0a45ff",
  curl: 100
};

/* The demo's Google Fonts. In a Next.js app, use next/font/google instead. */
if (typeof document !== "undefined" && !document.getElementById("card-deal-fonts")) {
  const style = document.createElement("style");
  style.id = "card-deal-fonts";
  style.textContent = "@import url('https://fonts.googleapis.com/css2?family=Host+Grotesk:wght@300..800&display=swap'); .rh-host-grotesk { font-family: 'Host Grotesk', sans-serif; }";
  document.head.appendChild(style);
}

const sans = { className: "rh-host-grotesk", style: { fontFamily: "'Host Grotesk', sans-serif" } };

/** A gentle entrance: rises and fades in, a beat after `delay` seconds. */
function Rise({ children, delay = 0, className = "" }: { children: ReactNode; delay?: number; className?: string }) {
  return (
    <div className={className} style={{ animation: `rh-rise 1.1s cubic-bezier(0.22, 1, 0.36, 1) ${delay}s both` }}>
      <style>{`@keyframes rh-rise { from { opacity: 0; transform: translateY(28px); } } @media (prefers-reduced-motion: reduce) { @keyframes rh-rise { from { opacity: 0; } } }`}</style>
      {children}
    </div>
  );
}

const ITEMS = [
  { title: "Design", line: "Brand, product and site, in one pass." },
  { title: "Build", line: "Fast, accessible code you can keep." },
  { title: "Launch", line: "Live on your own domain within the week." },
  { title: "Care", line: "Small fixes whenever you need them." },
];

const CARDS: DealCard[] = ITEMS.map((c) => ({
  label: `${c.title}: ${c.line}`,
  content: (
    // The card is the container and the padding sits inside, so cqw measures the whole card.
    // Coloured through the --deal-* variables, so the copy filled with the light gets white type on blue.
    <div className="h-full w-full bg-[var(--deal-bg,#fff)] text-[var(--deal-ink,#0a0a0b)] [container-type:size]">
      <div className="flex h-full flex-col justify-between p-[6cqw]">
        <span className="text-[8cqw] leading-none font-medium tracking-[-0.03em]">
          {c.title}
        </span>
        <span className="max-w-[62%] text-[3.8cqw] leading-[1.3] text-[var(--deal-mute,#6e6e73)]">
          {c.line}
        </span>
      </div>
    </div>
  ),
}));

function DemoContent(props: Partial<typeof settings> = {}) {
  const v = { ...settings, ...props };

  return (
    <main className={`${sans.className} bg-white text-white`}>
      <CardDeal cards={CARDS} tint={String(v.tint)} curl={Number(v.curl)}>
        {/* A night band: a blue bloom rises from below as the cards land, and the foot fades to the white page. */}
        <div className="absolute inset-0 bg-[#040a26]" />
        <div
          className="absolute inset-x-[-20%] bottom-0 h-[110svh]"
          style={{
            opacity: "calc(0.08 + var(--form) * 0.92)",
            translate: "0 calc((1 - var(--form)) * 18svh)",
          }}
        >
          <div className="absolute inset-0 bg-[radial-gradient(55%_62%_at_50%_100%,#dfe7ff_0%,#7d9bff_16%,#2f63ff_32%,#0a45ff_46%,#0a2a9e_64%,#071547_82%,transparent_96%)]" />
        </div>
        <div
          className="absolute inset-x-0 bottom-0 h-[24svh] bg-[linear-gradient(180deg,rgba(255,255,255,0)_0%,rgba(255,255,255,0.1)_25%,rgba(255,255,255,0.4)_55%,rgba(255,255,255,0.85)_82%,#fff_100%)]"
          style={{ opacity: "clamp(0, (var(--form) - 0.6) * 2.5, 1)" }}
        />
        {/* The hero line: rises in on load, then lifts, blurs and fades as the first card starts to come up. */}
        <div className="pointer-events-none absolute inset-0 flex items-center justify-center px-5 pb-[6svh] text-center">
          <Rise>
            <h2
              className="text-[clamp(2.4rem,6vw,4.5rem)] leading-[1.02] font-medium tracking-[-0.035em] text-balance"
              style={{
                opacity: "clamp(0, 1 - (var(--p) - 0.01) * 11, 1)",
                translate: "0 calc(clamp(0, var(--p) - 0.01, 0.1) * -60svh)",
                filter: "blur(calc(clamp(0, var(--p) - 0.01, 0.1) * 60px))",
              }}
            >
              <span className="block">Four Things, Done Well.</span>
              <span className="block text-white/55">Scroll to Deal Them.</span>
            </h2>
          </Rise>
        </div>
      </CardDeal>
      <section className="flex min-h-[50svh] items-center justify-center px-5 text-center text-[#0a0a0b]">
        <p className="text-[clamp(2rem,4vw,2.75rem)] leading-[1.09] font-medium tracking-[-0.025em]">
          All Dealt. <span className="text-[#6e6e73]">Point at the Grid.</span>
        </p>
      </section>
    </main>
  );
}

/** The demo in its own colours, filling the frame. */
export default function Demo(props: Partial<typeof settings> = {}) {
  return (
    <div className="min-h-svh w-full" style={{ background: "#040a26" }}>
      <DemoContent {...props} />
    </div>
  );
}

More by ReactHive

View all
  • Step Stack

    Step Stack

    20
  • Card Pack

    Card Pack

    12
  • Arc Gallery

    Arc Gallery

    9
  • Fluid Type

    Fluid Type

    7
  • Shoal

    Shoal

    7
  • Satin

    Satin

    6
  • Mercury Clock

    Mercury Clock

    3
  • Whirlwind

    Whirlwind

    2

More in Features

View all
  • Feature UI Row

    Feature UI Row

    41
  • Animated Bento Features

    Animated Bento Features

    143
  • Feature Sections

    Feature Sections

    117
  • Grid Feature Cards

    Grid Feature Cards

    1.9K
  • Feature Modern

    Feature Modern

    3
  • Features 8

    Features 8

    3.2K
  • Tabbed Feature Categories

    Tabbed Feature Categories

    101
  • Feature with image

    Feature with image

    162