Cards & content / Carousels

Saturated Highlight Card Strip

A horizontal strip of equal-width rounded cards, each a flat saturated blue gradient from cyan through indigo to deep navy, with a white title, a dated subtitle, a short blurb and a 'Learn more' link pinned to the bottom. Overflowing cards bleed off the right.

Rebuilt from stripe.com/blog in the Iridescent Ledger style.

npx shadcn@latest add https://justyoink.it/r/iridescent-ledger/blocks/highlight-color-cards.json

Looks exactly like stripe.com: brings its fonts and colours, namespaced so your own theme stays untouched.

Usage

Props: heading, cards (title, date, body, href, bg class) and linkLabel. Scroll horizontally or drag with the pointer; cards lift with a stronger shadow on hover.

components/highlight-color-cards.tsx
"use client";

import { useEffect, useLayoutEffect, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react";
import { useRef } from "react";

type Card = { title: string; date: string; body: string; href?: string; bg: string };

const defaultCards: Card[] = [
  { title: "Planning inventory for a busy season", date: "March 12, 2026", body: "Walk through forecasting methods with our ops team in Denver. Space is limited.", bg: "bg-[#00bff5]" },
  { title: "Warehouse robotics arrive in your toolkit", date: "March 12, 2026", body: "See how autonomous pickers are changing fulfilment, live at the Northwind open house. Save your seat today.", bg: "bg-[#0076e4]" },
  { title: "Introducing weekly rollups, a calmer view of your numbers", date: "January 20, 2026", body: "Review sales, returns and margin in one tidy summary delivered each Monday morning, ready to share with your team.", bg: "bg-[#0036b0]" },
  { title: "Invoice scheduling now in Canada", date: "November 5, 2025", body: "Teams in Canada can queue invoices ahead of time, set reminders and see when customers open them, any day of the week, with no extra setup required.", bg: "bg-[#635bff]" },
  { title: "Launching Kitefield, a faster ledger engine", date: "October 2, 2025", body: "Kitefield is a new reconciliation layer built for high volume teams that need clean books at lower cost.", bg: "bg-[#06214d]" },
];

export default function SaturatedHighlightCardStrip({
  heading = "Latest news",
  cards = defaultCards,
  linkLabel = "Read more",
}: {
  heading?: string;
  cards?: Card[];
  linkLabel?: string;
}) {
  const ref = useRef<HTMLDivElement>(null);
  const drag = useRef({ down: false, x: 0, left: 0 });

  return (
    <section className="relative overflow-hidden bg-canvas py-20 text-ink">
      <div className="mx-auto max-w-[1080px] px-4">
        <Reveal>
          <h2 className="font-display text-h3 text-ink-deep">{heading}</h2>
        </Reveal>
      </div>
      <div
        ref={ref}
        className="mx-auto mt-16 flex max-w-[1260px] cursor-grab snap-x gap-[26px] overflow-x-auto px-4 pb-8 [scrollbar-width:none] active:cursor-grabbing [&::-webkit-scrollbar]:hidden"
        onPointerDown={(e) => {
          drag.current = { down: true, x: e.clientX, left: ref.current?.scrollLeft ?? 0 };
        }}
        onPointerMove={(e) => {
          if (drag.current.down && ref.current) ref.current.scrollLeft = drag.current.left - (e.clientX - drag.current.x);
        }}
        onPointerUp={() => (drag.current.down = false)}
        onPointerLeave={() => (drag.current.down = false)}
      >
        {cards.map((c) => (
          <article
            key={c.title}
            className={`${c.bg} flex min-h-[369px] w-[244px] shrink-0 snap-start flex-col rounded-md p-4 text-white shadow-card transition-all duration-smooth ease-smooth hover:-translate-y-1 hover:shadow-floating`}
          >
            <h3 className="text-lead font-semibold leading-7">{c.title}</h3>
            <p className="mt-1 text-ui text-white/70">{c.date}</p>
            <p className="mt-4 text-ui text-white/90">{c.body}</p>
            <a
              href={c.href ?? "#"}
              className="mt-auto inline-flex items-center gap-1 pt-6 text-ui font-semibold focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
            >
              {linkLabel}
              <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
                <path d="M4 2l4 4-4 4" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" />
              </svg>
            </a>
          </article>
        ))}
      </div>
    </section>
  );
}

// ---- Yoink motion (inlined, no dependencies): Reveal ----

const YK_EASE = "cubic-bezier(0.16, 1, 0.3, 1)";

const useYkLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;

function ykReducedMotion(): boolean {
  return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
}

// "idle": untouched (visible) · "hidden": waiting below the fold · "shown": play the entrance.
// Content is only hidden once we know we can show it again (IntersectionObserver exists, motion allowed,
// and there is a box to watch), and a safety net reveals anything on screen that is still hidden.
type YkRevealState = "idle" | "hidden" | "shown";

function useYkReveal(ref: RefObject<Element | null>, once = true): YkRevealState {
  const [state, setState] = useState<YkRevealState>("idle");
  useYkLayoutEffect(() => {
    const el = ref.current;
    if (!el || ykReducedMotion() || typeof IntersectionObserver === "undefined") return;
    // watch the element's own box, or its children when it has none (display: contents)
    const boxes = () => (getComputedStyle(el).display === "contents" ? Array.from(el.children) : [el]);
    const onScreen = (t: Element) => {
      const r = t.getBoundingClientRect();
      return (r.width > 0 || r.height > 0) && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth;
    };
    if (!boxes().some((t) => t.getBoundingClientRect().width > 0 || t.getBoundingClientRect().height > 0)) return; // e.g. hidden at mount: leave it visible
    let shown = false;
    const show = (v: boolean) => {
      if (v !== shown) (shown = v), setState(v ? "shown" : "hidden");
    };
    setState("hidden");
    const inView = new Set<Element>();
    const io = new IntersectionObserver((entries) => {
      for (const e of entries) {
        if (e.isIntersecting) inView.add(e.target);
        else inView.delete(e.target);
      }
      if (inView.size) {
        show(true);
        if (once) io.disconnect();
      } else if (!once) show(false);
    });
    const watched = new Set<Element>();
    const watch = () => boxes().forEach((t) => !watched.has(t) && (watched.add(t), io.observe(t)));
    watch();
    // safety net: styles that land after mount (display: contents) get watched too, and nothing
    // stays hidden for more than a moment while it is actually on screen
    const start = Date.now();
    const net = setInterval(() => {
      if (shown) return once && clearInterval(net);
      watch();
      if (Date.now() - start > 2400 && boxes().some(onScreen)) show(true);
    }, 600);
    return () => {
      io.disconnect();
      clearInterval(net);
    };
  }, [once]);
  return state;
}

type YkRevealFrom = "up" | "down" | "left" | "right" | "scale" | "blur" | "none";

/** Fades content in as it scrolls into view. */
function Reveal({
  children,
  from = "up",
  delay = 0,
  duration = 700,
  distance = 24,
  once = true,
  as = "div",
  className,
  style,
}: {
  children?: ReactNode;
  from?: YkRevealFrom;
  delay?: number;
  duration?: number;
  distance?: number;
  once?: boolean;
  as?: ElementType;
  className?: string;
  style?: CSSProperties;
}) {
  const Tag = as;
  const ref = useRef<HTMLElement>(null);
  const state = useYkReveal(ref, once);
  const hidden = state === "hidden";
  const offset = {
    up: `translate3d(0, ${distance}px, 0)`,
    down: `translate3d(0, ${-distance}px, 0)`,
    left: `translate3d(${-distance}px, 0, 0)`,
    right: `translate3d(${distance}px, 0, 0)`,
    scale: "scale(0.94)",
    blur: `translate3d(0, ${distance / 2}px, 0)`,
    none: "none",
  }[from];
  const t = `${duration}ms ${YK_EASE} ${delay}ms`;
  return (
    <Tag
      ref={ref}
      className={className}
      style={{
        ...style,
        ...(hidden && { opacity: 0, transform: offset, filter: from === "blur" ? "blur(12px)" : undefined }),
        ...(state === "shown" && { transition: `opacity ${t}, transform ${t}, filter ${t}` }),
      }}
    >
      {children}
    </Tag>
  );
}

Quality checks

Automated, in a real browser · 5d ago
—

More from Iridescent Ledger

The whole style →

Checklist Feature Columns

Feature sections

Iridescent Ribbon Hero

Heroes

Dated Article Row

Blog & articles

Frosted Hairline Header

Headers & nav bars

Sticky Pill Sub-Navigation

Tab bars

Mockup Bento Grid

Feature sections