Page sections / Comparison tables
Highlighted Column Comparison Table
Borderless row-ruled table with one raised, bordered column for the product against a muted competitor column. Left labels white, competitor text dim, product text bright.
Rebuilt from silico.ai in the Moonlit Atelier style.
npx shadcn@latest add https://justyoink.it/r/moonlit-atelier/blocks/highlight-column-comparison.json
Looks exactly like silico.ai: brings its fonts and colours, namespaced so your own theme stays untouched.
npx shadcn@latest add https://justyoink.it/r/moonlit-atelier/mine/highlight-column-comparison.json
Restyled to your project: uses your shadcn colours, fonts and radius, so it matches the rest of your app. Layout, type sizes and motion stay as designed.
Usage
Pass heading, intro, corner, otherName, ourName and rows ({label, other, ours}[]) to customize; all have defaults. The heading block and intro fade in on scroll; table rows are static.
components/highlight-column-comparison.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; type Row = { label: string; other: string; ours: string }; type Props = { heading?: string; intro?: string; corner?: string; otherName?: string; ourName?: string; rows?: Row[]; }; const defaultRows: Row[] = [ { label: "What you receive", other: "A draft to review and edit yourself", ours: "The completed report, site or workflow" }, { label: "Who handles it", other: "A single helper, one task at a time", ours: "A lead agent with a team working in parallel" }, { label: "Model choice", other: "Typically one vendor's lineup", ours: "Dozens of models matched to each step" }, { label: "Tools available", other: "Chat with a few plug-ins", ours: "A private workspace with browser and files" }, { label: "Verification", other: "You review every output", ours: "Results are run and checked before delivery" }, { label: "While you're away", other: "It idles until you reply", ours: "It continues, follows a schedule and updates you" }, { label: "Pricing", other: "A recurring monthly plan", ours: "Pay per use, credits never lapse" }, ]; export default function HighlightedColumnComparisonTable({ heading = "Plenty of tools describe the task. Northwind completes it.", intro = "A typical assistant offers a helpful first draft. Northwind is designed to take the work all the way to done.", corner = "Compared", otherName = "A standard assistant", ourName = "Northwind", rows = defaultRows, }: Props) { return ( <section className="bg-canvas px-5 py-20 text-primary md:px-10 md:py-24"> <div className="mx-auto max-w-[1400px]"> <div className="grid gap-8 lg:grid-cols-12"> <Reveal from="up" distance={13} duration={740} as="div" className="lg:col-span-7"> <h2 className="font-serif text-[40px] leading-[1.05] tracking-[-0.02em] text-primary md:text-[64px]">{heading}</h2> </Reveal> <p className="text-body text-secondary lg:col-span-4 lg:col-start-9">{intro}</p> </div> <div className="mt-16 overflow-x-auto"> <table className="w-full min-w-[720px] border-separate border-spacing-0 text-left font-sans text-[15px]"> <colgroup> <col className="w-[27%]" /> <col className="w-[30%]" /> <col className="w-[43%]" /> </colgroup> <thead> <tr> <th scope="col" className="h-14 border-b border-hairline py-3 pr-4 text-[13px] font-normal text-muted">{corner}</th> <th scope="col" className="h-14 border-b border-hairline py-3 pr-4 font-medium text-muted">{otherName}</th> <th scope="col" className="h-14 rounded-none border border-b-hairline border-hairline bg-surface-raised px-4 py-3 font-medium text-primary">{ourName}</th> </tr> </thead> <tbody> {rows.map((r, i) => { const last = i === rows.length - 1; return ( <tr key={r.label}> <th scope="row" className={`h-[55px] py-3 pr-4 font-normal text-primary ${last ? "" : "border-b border-hairline"}`}>{r.label}</th> <td className={`h-[55px] py-3 pr-4 text-muted ${last ? "" : "border-b border-hairline"}`}>{r.other}</td> <td className={`h-[55px] border-x border-hairline bg-surface-raised px-4 py-3 text-primary ${last ? "border-b" : "border-b border-b-hairline"}`}>{r.ours}</td> </tr> ); })} </tbody> </table> </div> </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> ); }"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; type Row = { label: string; other: string; ours: string }; type Props = { heading?: string; intro?: string; corner?: string; otherName?: string; ourName?: string; rows?: Row[]; }; const defaultRows: Row[] = [ { label: "What you receive", other: "A draft to review and edit yourself", ours: "The completed report, site or workflow" }, { label: "Who handles it", other: "A single helper, one task at a time", ours: "A lead agent with a team working in parallel" }, { label: "Model choice", other: "Typically one vendor's lineup", ours: "Dozens of models matched to each step" }, { label: "Tools available", other: "Chat with a few plug-ins", ours: "A private workspace with browser and files" }, { label: "Verification", other: "You review every output", ours: "Results are run and checked before delivery" }, { label: "While you're away", other: "It idles until you reply", ours: "It continues, follows a schedule and updates you" }, { label: "Pricing", other: "A recurring monthly plan", ours: "Pay per use, credits never lapse" }, ]; export default function HighlightedColumnComparisonTable({ heading = "Plenty of tools describe the task. Northwind completes it.", intro = "A typical assistant offers a helpful first draft. Northwind is designed to take the work all the way to done.", corner = "Compared", otherName = "A standard assistant", ourName = "Northwind", rows = defaultRows, }: Props) { return ( <section className="bg-background px-5 py-20 text-foreground md:px-10 md:py-24"> <div className="mx-auto max-w-[1400px]"> <div className="grid gap-8 lg:grid-cols-12"> <Reveal from="up" distance={13} duration={740} as="div" className="lg:col-span-7"> <h2 className="font-sans text-[40px] leading-[1.05] tracking-[-0.02em] text-foreground md:text-[64px]">{heading}</h2> </Reveal> <p className="text-moonlit-body text-muted-foreground lg:col-span-4 lg:col-start-9">{intro}</p> </div> <div className="mt-16 overflow-x-auto"> <table className="w-full min-w-[720px] border-separate border-spacing-0 text-left font-sans text-[15px]"> <colgroup> <col className="w-[27%]" /> <col className="w-[30%]" /> <col className="w-[43%]" /> </colgroup> <thead> <tr> <th scope="col" className="h-14 border-b border-border py-3 pr-4 text-[13px] font-normal text-muted-foreground">{corner}</th> <th scope="col" className="h-14 border-b border-border py-3 pr-4 font-medium text-muted-foreground">{otherName}</th> <th scope="col" className="h-14 rounded-none border border-b-border border-border bg-muted px-4 py-3 font-medium text-foreground">{ourName}</th> </tr> </thead> <tbody> {rows.map((r, i) => { const last = i === rows.length - 1; return ( <tr key={r.label}> <th scope="row" className={`h-[55px] py-3 pr-4 font-normal text-foreground ${last ? "" : "border-b border-border"}`}>{r.label}</th> <td className={`h-[55px] py-3 pr-4 text-muted-foreground ${last ? "" : "border-b border-border"}`}>{r.other}</td> <td className={`h-[55px] border-x border-border bg-muted px-4 py-3 text-foreground ${last ? "border-b" : "border-b border-b-border"}`}>{r.ours}</td> </tr> ); })} </tbody> </table> </div> </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 · 4d ago- Accessible: not passedElements must meet minimum color contrast ratio thresholds (9 elements)Scrollable region must have keyboard access (1 element)
- Responsive: passedRenders at phone (390px), tablet (768px) and desktop width without sideways scrolling.
- Dark mode: passedStill readable when installed in your theme and switched to dark mode.
- Themeable: passedUses design tokens rather than hard-coded colours, so it follows your theme cleanly.
- Animates cleanly: passedIts animation plays and finishes with everything visible, and it stays still for people who turn on reduced motion.