Cards & content / Tables

Airy Spec Table Card

Rounded hairline card with borderless table rows: muted column headers, bold row names with grey sublabels, and values with 'then $…' secondary lines. A small outlined arrow-link pill sits centered below.

Rebuilt from supabase.com/pricing in the Emerald Paper Precision style.

npx shadcn@latest add https://justyoink.it/r/emerald-paper-precision/blocks/spec-comparison-table.json

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

Usage

Pass title, subtitle, rows (name, sub, max, size[], iops[], throughput[], durability), linkLabel and linkHref. Renders standalone with defaults; the table scrolls horizontally on small screens.

components/spec-comparison-table.tsx
"use client";

import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react";
type Row = {
  name: string;
  sub: string;
  max: string;
  size: string[];
  iops: string[];
  throughput: string[];
  durability: string;
};

type Props = {
  title?: string;
  subtitle?: string;
  rows?: Row[];
  linkLabel?: string;
  linkHref?: string;
};

const defaultRows: Row[] = [
  {
    name: "Standard Tier",
    sub: "Balanced cost and speed",
    max: "32 TB",
    size: ["10 GB included", "then $0.10 per GB"],
    iops: ["2,000 IOPS included", "then $0.02 per IOPS"],
    throughput: ["100 MB/s included", "then $0.08 per MB/s"],
    durability: "99.9%",
  },
  {
    name: "Turbo Tier",
    sub: "For latency-sensitive workloads",
    max: "48 TB",
    size: ["$0.17 per GB"],
    iops: ["$0.10 per IOPS"],
    throughput: ["Scales with IOPS"],
    durability: "99.995%",
  },
];

const Cell = ({ lines }: { lines: string[] }) => (
  <div className="text-body text-ink">
    {lines.map((l) => (
      <div key={l}>{l}</div>
    ))}
  </div>
);

export default function AirySpecTableCard({
  title = "Flexible volume settings",
  subtitle = "Grow block storage up to 48 TB and 60,000 IOPS.",
  rows = defaultRows,
  linkLabel = "Read the volume guide",
  linkHref = "#",
}: Props) {
  const heads = ["Max Size", "Size", "IOPS", "Throughput", "Durability"];
  return (
    <section className="bg-canvas px-4 py-20 font-sans text-ink">
      <Reveal from="up" className="mx-auto max-w-[1152px]">
        <div className="text-center">
          <h2 className="font-display text-h2 tracking-[-0.02em] text-ink">{title}</h2>
          <p className="mt-3 text-lead text-ink-soft">{subtitle}</p>
        </div>

        <div className="mt-16 overflow-x-auto rounded-xl border border-hairline bg-surface p-5">
          <table className="w-full min-w-[960px] border-separate border-spacing-0 text-left">
            <thead>
              <tr>
                <th className="w-[26%] pb-4" aria-label="Tier" />
                {heads.map((h, i) => (
                  <th
                    key={h}
                    className={"pb-4 text-label font-normal text-ink-muted " + (i === 4 ? "text-right" : "")}
                  >
                    {h}
                  </th>
                ))}
              </tr>
            </thead>
            <tbody>
              {rows.map((r) => (
                <tr key={r.name}>
                  <td className="py-4 pr-4 align-middle">
                    <div className="text-body font-medium text-ink">{r.name}</div>
                    <div className="text-body text-ink-muted">{r.sub}</div>
                  </td>
                  <td className="py-4 align-middle text-body text-ink">{r.max}</td>
                  <td className="py-4 pr-4 align-middle"><Cell lines={r.size} /></td>
                  <td className="py-4 pr-4 align-middle"><Cell lines={r.iops} /></td>
                  <td className="py-4 pr-4 align-middle"><Cell lines={r.throughput} /></td>
                  <td className="py-4 text-right align-middle text-body text-ink">{r.durability}</td>
                </tr>
              ))}
            </tbody>
          </table>
        </div>

        <div className="mt-8 flex justify-center">
          <a
            href={linkHref}
            className="inline-flex items-center gap-2 rounded-md border border-hairline bg-surface px-2.5 py-1.5 text-caption text-ink transition-colors duration-hover-color ease-hover-color hover:border-hairline-strong focus-visible:outline focus-visible:outline-2 focus-visible:outline-brand"
          >
            {linkLabel}
            <svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" strokeWidth="1.2" aria-hidden="true">
              <path d="M2 8 8 2M3.5 2H8v4.5" />
            </svg>
          </a>
        </div>
      </Reveal>
    </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 · 4d ago
—

More from Emerald Paper Precision

The whole style →

Hairline Site Header

Headers & nav bars

Framework Icon Tab Code Panel

Code blocks

Gradient Customer Story Strip

Testimonials

Compute Pricing Calculator

Forms

Two-Tone Split Hero

Heroes

Hairline Bento Product Grid

Feature sections