ReactHive

Shoal

Heroes 6

About

A headline swum by a shoal of sardines, printed as a cyanotype. The fish stream in, mill in a slow crescent, then settle into the word, each holding its place against a current. The pointer is a predator: the shoal splits round it. A click sends them to the next word.

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

Code

How Shoal 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 { Shoal } from "@/components/ui/shoal";

const settings = {
  density: 1.4,
  fear: 1,
  interval: 0
};

/* The demo's Google Fonts. In a Next.js app, use next/font/google instead. */
if (typeof document !== "undefined" && !document.getElementById("shoal-fonts")) {
  const style = document.createElement("style");
  style.id = "shoal-fonts";
  style.textContent = "@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Inter+Tight:wght@100..900&display=swap'); .rh-archivo-black { font-family: 'Archivo Black', sans-serif; } .rh-inter-tight { font-family: 'Inter Tight', sans-serif; }";
  document.head.appendChild(style);
}

/** 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 letters = { className: "rh-archivo-black", style: { fontFamily: "'Archivo Black', sans-serif" } };
const type = { className: "rh-inter-tight", style: { fontFamily: "'Inter Tight', sans-serif" } };

// Kept outside the component, so the shoal isn't rebuilt on every render.
const WORDS = ["SHOAL", "DRIFT", "DEEP"];

function DemoContent(props: Partial<typeof settings> = {}) {
  const v = { ...settings, ...props };
  return (
    <main className={`${type.className} relative h-svh cursor-pointer overflow-hidden bg-[#f4f6f8] text-[#f4f6f8]`}>
      <Shoal words={WORDS} weight={400} density={Number(v.density)} fear={Number(v.fear)} interval={Number(v.interval)} className={letters.className} />
      <div className="pointer-events-none absolute inset-[3.5vmin] flex flex-col justify-between p-[3.5vmin] text-[13px] leading-[18px] sm:text-[14px]">
        <Rise className="flex justify-between gap-6">
          <span className="font-semibold">Mareia, an ocean film week</span>
          <span className="text-right text-[#f4f6f8]/70">Lisbon, 12 to 18 May</span>
        </Rise>
        <Rise delay={0.15} className="flex items-end justify-between gap-6">
          <span className="max-w-[17rem] text-[#f4f6f8]/70">Sardina pilchardus, cyanotype on cotton paper. Move through them, or click to send them on.</span>
          <span className="hidden text-[#f4f6f8]/70 sm:block">No. 01</span>
        </Rise>
      </div>
    </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: "#1d4f9c" }}>
      <DemoContent {...props} />
    </div>
  );
}

More by ReactHive

View all
  • Card Deal

    Card Deal

    14
  • Step Stack

    Step Stack

    10
  • Card Pack

    Card Pack

    9
  • Satin

    Satin

    5
  • Arc Gallery

    Arc Gallery

    4
  • Fluid Type

    Fluid Type

    3
  • Mercury Clock

    Mercury Clock

    3
  • Whirlwind

    Whirlwind

    2

More in Heroes

View all
  • Agency Hero Section

    Agency Hero Section

    1.1K
  • Hero Section 01

    Hero Section 01

    69
  • SaaS Template

    SaaS Template

    2.7K
  • Hero

    Hero

    1.4K
  • Responsive Hero Banner

    Responsive Hero Banner

    2.2K
  • Real Estate 3D Hero

    Real Estate 3D Hero

    59
  • Facts Hero

    Facts Hero

    9
  • Centered Hero with Image Fan

    Centered Hero with Image Fan

    1.1K