Forms & inputs / Forms

Newsletter Signup Block

A tinted band with a heading, muted lead, a pill-shaped input with a placeholder and a purple pill Subscribe button, and a legal note. To the right sit two icon columns with duotone illustrations and arrow links.

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

npx shadcn@latest add https://justyoink.it/r/iridescent-ledger/blocks/newsletter-footer-cta.json

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

Usage

All copy, link labels and hrefs are props with defaults; pass onSubscribe(email) to handle form submission. Renders standalone with no props.

components/newsletter-footer-cta.tsx
"use client";

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

type Props = {
  heading?: string;
  lead?: string;
  placeholder?: string;
  buttonLabel?: string;
  legalText?: string;
  legalLinkLabel?: string;
  legalHref?: string;
  firstTitle?: string;
  firstBody?: string;
  firstLinkLabel?: string;
  firstHref?: string;
  secondTitle?: string;
  secondBody?: string;
  secondLinkLabel?: string;
  secondHref?: string;
  onSubscribe?: (email: string) => void;
};

function Chevron() {
  return (
    <svg aria-hidden="true" width="8" height="10" viewBox="0 0 8 10" className="transition-transform duration-smooth ease-smooth group-hover:translate-x-[3px]" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
      <path d="M2 1l4 4-4 4" />
    </svg>
  );
}

export default function NewsletterSignupBlock({
  heading = "Join the Harbor Notes digest",
  lead = "Get fresh articles and product updates from Harbor delivered to your inbox.",
  placeholder = "name@company.com",
  buttonLabel = "Sign up",
  legalText = "We only use your address to send the digest. See our",
  legalLinkLabel = "Privacy Notice",
  legalHref = "#",
  firstTitle = "Enjoyed this article? Come work with us.",
  firstBody = "Harbor creates tools that help small teams run their operations with less friction.",
  firstLinkLabel = "See openings",
  firstHref = "#",
  secondTitle = "Got a suggestion or a question?",
  secondBody = "Our team would be glad to chat.",
  secondLinkLabel = "Get in touch",
  secondHref = "#",
  onSubscribe,
}: Props) {
  const [email, setEmail] = useState("");
  return (
    <section className="bg-canvas">
      <div className="bg-surface-tint">
        <div className="mx-auto max-w-[1080px] px-4 py-16 md:py-28">
          <div className="grid gap-12 md:grid-cols-4 md:gap-0">
            <Reveal className="md:col-span-2 md:pr-16">
              <h2 className="text-h3 font-display text-ink-deep">{heading}</h2>
              <p className="mt-5 max-w-md text-lead font-light text-ink-muted">{lead}</p>
              <form
                className="mt-7 flex flex-col gap-2 sm:flex-row sm:items-center"
                onSubmit={(e) => {
                  e.preventDefault();
                  onSubscribe?.(email);
                }}
              >
                <label htmlFor="nl-email" className="sr-only">Email address</label>
                <input
                  id="nl-email"
                  type="email"
                  value={email}
                  onChange={(e) => setEmail(e.target.value)}
                  placeholder={placeholder}
                  className="h-9 w-full rounded-pill border border-hairline bg-surface px-3 text-ui text-ink outline-none transition-shadow duration-link ease-link placeholder:text-ink-faint focus:border-accent focus:ring-2 focus:ring-accent/40 sm:w-[305px]"
                />
                <button
                  type="submit"
                  className="group inline-flex h-9 items-center justify-center gap-2 rounded-pill bg-accent px-4 text-ui font-medium text-surface transition-colors duration-link ease-link hover:bg-accent-soft hover:text-accent focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent"
                >
                  {buttonLabel}
                  <Chevron />
                </button>
              </form>
              <p className="mt-4 text-caption text-ink-faint">
                {legalText}{" "}
                <a href={legalHref} className="font-medium text-accent hover:underline">{legalPolicy(legalLinkLabel)}</a>
              </p>
            </Reveal>

            <Reveal delay={100} className="md:border-l md:border-dashed md:border-hairline md:px-4">
              <div aria-hidden="true" className="mb-8 flex h-10 w-10 items-end gap-1">
                <div className="h-10 w-5 rounded-xs bg-accent" />
                <div className="h-8 w-4 rounded-xs bg-accent-soft ring-1 ring-accent/30" />
              </div>
              <h3 className="text-ui font-medium text-ink-deep">{firstTitle}</h3>
              <p className="mt-4 text-body font-light text-ink-muted">{firstBody}</p>
              <a href={firstHref} className="group mt-4 inline-flex items-center gap-2 text-ui font-medium text-accent">
                {firstLinkLabel}
                <Chevron />
              </a>
            </Reveal>

            <Reveal delay={200} className="md:border-l md:border-dashed md:border-hairline md:px-4">
              <div aria-hidden="true" className="mb-8 flex h-10 w-10 items-center justify-center rounded-full bg-accent-soft">
                <span className="text-h3 font-semibold text-accent">?</span>
              </div>
              <h3 className="text-ui font-medium text-ink-deep">{secondTitle}</h3>
              <p className="mt-4 text-body font-light text-ink-muted">{secondBody}</p>
              <a href={secondHref} className="group mt-4 inline-flex items-center gap-2 text-ui font-medium text-accent">
                {secondLinkLabel}
                <Chevron />
              </a>
            </Reveal>
          </div>
        </div>
      </div>
    </section>
  );
}

function legalPolicy(s: string) {
  return s;
}

// ---- 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

Saturated Highlight Card Strip

Carousels

Frosted Hairline Header

Headers & nav bars

Sticky Pill Sub-Navigation

Tab bars