Starter Template Card Grid
Asymmetric grid: two large cards with logo, title, muted description and a cropped wireframe app-window preview bleeding off the bottom, over a row of four compact cards with small icon, title and line-clamped description. All white with hairline borders and ~16px radius.
Rebuilt from supabase.com in the Emerald Paper Precision style.
Looks exactly like supabase.com: brings its fonts and colours, namespaced so your own theme stays untouched.
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
Props: headingMuted, headingStrong, linkLabel, linkHref, featured (two large cards with title/description) and compact (four small cards). Renders standalone with defaults; logos and window previews are drawn in code.
components/starter-template-cards.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; type Card = { title: string; description: string }; type Props = { headingMuted?: string; headingStrong?: string; linkLabel?: string; linkHref?: string; featured?: Card[]; compact?: Card[]; }; const defaultFeatured: Card[] = [ { title: "Billing Console Starter", description: "A complete recurring-payments kit for fast-moving web products, wired up with hosted checkout, a database and edge deploys." }, { title: "Dashboard Starter", description: "A server-rendered app template with session-based sign in, typed data access and a utility-first design setup." }, ]; const defaultCompact: Card[] = [ { title: "Assistant Chat", description: "An open-source conversational app template with streaming replies, history and a clean message composer built in." }, { title: "Retrieval Starter", description: "Starter template and sample use-cases for building document search and question answering features quickly." }, { title: "Mobile Accounts", description: "Get going with a cross-platform app by building a profile and account screen backed by a hosted database." }, { title: "Native Monorepo Starter", description: "An extended monorepo setup for shipping a mobile and web app from one shared typed codebase." }, ]; function Mark({ i, size = 20 }: { i: number; size?: number }) { const s = size; const shapes = [ <svg key="0" width={s} height={s} viewBox="0 0 20 20" aria-hidden="true"><rect x="2" y="4" width="16" height="12" rx="3" fill="var(--color-brand)" /><rect x="5" y="8" width="10" height="2" rx="1" fill="var(--color-surface)" /></svg>, <svg key="1" width={s} height={s} viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="9" fill="var(--color-ink)" /><path d="M7 14V6l6 8V6" stroke="var(--color-surface)" strokeWidth="1.5" fill="none" /></svg>, <svg key="2" width={s} height={s} viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="7" fill="none" stroke="var(--color-ink)" strokeWidth="1.5" /><circle cx="10" cy="10" r="3" fill="none" stroke="var(--color-ink)" strokeWidth="1.5" /></svg>, <svg key="3" width={s} height={s} viewBox="0 0 20 20" aria-hidden="true"><rect x="1" y="1" width="18" height="18" rx="4" fill="var(--color-night)" /><path d="M7 13l6-6" stroke="var(--color-brand-bright)" strokeWidth="2" /></svg>, <svg key="4" width={s} height={s} viewBox="0 0 20 20" aria-hidden="true"><path d="M3 17L12 3l5 7-6 7z" fill="var(--color-brand-bright)" /></svg>, <svg key="5" width={s} height={s} viewBox="0 0 20 20" aria-hidden="true"><path d="M2 17L10 3l8 14h-4l-4-7-4 7z" fill="var(--color-night)" /></svg>, ]; return shapes[i % shapes.length]; } function Window({ variant }: { variant: number }) { return ( <div className="mt-auto overflow-hidden rounded-t-lg border border-b-0 border-hairline bg-surface"> <div className="flex items-center gap-1.5 border-b border-hairline bg-surface px-3 py-2.5"> {[0, 1, 2].map((d) => <span key={d} className="h-2.5 w-2.5 rounded-pill bg-hairline-strong" />)} </div> {variant === 0 ? ( <div className="flex h-[150px] justify-center bg-surface-muted/60 pt-6"> <div className="grid w-[288px] grid-cols-3 border border-b-0 border-hairline bg-surface"> {[0, 1, 2].map((c) => ( <div key={c} className={"flex flex-col items-center gap-1.5 border-r border-hairline p-2 last:border-r-0 " + (c === 1 ? "bg-brand-tint" : "")}> <span className={"h-2 w-8 rounded-pill " + (c === 1 ? "bg-brand-bright/60" : "bg-hairline")} /> <span className={"h-2 w-16 rounded-pill " + (c === 1 ? "bg-brand" : "bg-hairline")} /> <span className="mt-3 h-20 w-full rounded-md bg-surface-muted" /> </div> ))} </div> </div> ) : ( <div className="flex h-[150px] bg-surface"> <div className="w-[96px] shrink-0 space-y-2 border-r border-hairline p-3"> <span className="block h-2.5 w-2.5 rounded-pill bg-brand-bright" /> <span className="mt-4 block h-1.5 w-full rounded-pill bg-hairline" /> <span className="block h-1.5 w-4/5 rounded-pill bg-hairline" /> <span className="block h-1.5 w-full rounded-pill bg-hairline" /> </div> <div className="grid flex-1 grid-cols-4 content-start gap-2 p-3"> {[1, 0, 1, 1, 1, 1, 0, 1].map((d, k) => ( <span key={k} className={"h-[56px] rounded-md " + (d ? "bg-surface-muted" : "bg-canvas border border-hairline")} /> ))} </div> </div> )} </div> ); } export default function StarterTemplateCardGrid({ headingMuted = "Launch your next build", headingStrong = "from battle-tested starter kits", linkLabel = "Browse all templates", linkHref = "#", featured = defaultFeatured, compact = defaultCompact, }: Props) { const card = "group rounded-xl border border-hairline bg-surface transition-colors duration-base-transition ease-base-transition hover:border-hairline-strong focus-within:border-hairline-strong"; return ( <section className="bg-canvas px-5 py-16 font-sans text-ink md:px-10 md:py-24"> <div className="mx-auto max-w-[1088px]"> <div className="flex flex-wrap items-end justify-between gap-4"> <h2 className="font-display text-[32px] font-medium leading-[1.1] tracking-[-0.03em] md:text-[40px]"> <span className="block text-ink-muted">{headingMuted}</span> <span className="block text-ink">{headingStrong}</span> </h2> <a href={linkHref} className="text-label text-ink-soft underline underline-offset-2 transition-colors duration-hover-color ease-hover-color hover:text-brand focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand rounded-xs"> {linkLabel} </a> </div> <Stagger step={90} from="up" className="mt-12 grid gap-3 md:mt-16 md:grid-cols-2"> {featured.map((c, i) => ( <a key={c.title} href="#" className={card + " flex min-h-[375px] flex-col overflow-hidden px-6 pt-6 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand"}> <Mark i={i} size={20} /> <h3 className="mt-4 text-[14px] font-medium leading-5 text-ink">{c.title}</h3> <p className="mt-1 mb-9 text-[14px] leading-5 text-ink-muted">{c.description}</p> <Window variant={i} /> </a> ))} </Stagger> <Stagger step={70} from="up" className="mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4"> {compact.map((c, i) => ( <a key={c.title} href="#" className={card + " block p-6 pt-8 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand"}> <Mark i={i + 2} size={20} /> <h3 className="mt-5 text-[14px] font-medium leading-5 text-ink">{c.title}</h3> <p className="mt-1 line-clamp-2 text-[14px] leading-5 text-ink-muted">{c.description}</p> </a> ))} </Stagger> </div> </section> ); } // ---- Yoink motion (inlined, no dependencies): Stagger ---- 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; } /** Reveals each direct child one after another when the group scrolls into view. */ function Stagger({ children, step = 90, from = "up", distance = 20, duration = 650, delay = 0, once = true, as = "div", className, style, }: { children?: ReactNode; step?: number; from?: "up" | "down" | "left" | "right" | "scale" | "fade"; distance?: number; duration?: number; delay?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); useYkLayoutEffect(() => { const items = Array.from(ref.current?.children ?? []) as HTMLElement[]; if (state === "idle") return; 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.92)", fade: "none", }[from]; if (state === "hidden") { for (const el of items) Object.assign(el.style, { transition: "none", opacity: "0", transform: offset }); return; } items.forEach((el, i) => { const t = `${duration}ms ${YK_EASE} ${delay + i * step}ms`; Object.assign(el.style, { transition: `opacity ${t}, transform ${t}`, opacity: "", transform: "" }); }); // hand the children their own transitions back once everything has landed const done = setTimeout(() => items.forEach((el) => (el.style.transition = "")), delay + items.length * step + duration + 50); return () => clearTimeout(done); }, [state]); return ( <Tag ref={ref} className={className} style={style}> {children} </Tag> ); }"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; type Card = { title: string; description: string }; type Props = { headingMuted?: string; headingStrong?: string; linkLabel?: string; linkHref?: string; featured?: Card[]; compact?: Card[]; }; const defaultFeatured: Card[] = [ { title: "Billing Console Starter", description: "A complete recurring-payments kit for fast-moving web products, wired up with hosted checkout, a database and edge deploys." }, { title: "Dashboard Starter", description: "A server-rendered app template with session-based sign in, typed data access and a utility-first design setup." }, ]; const defaultCompact: Card[] = [ { title: "Assistant Chat", description: "An open-source conversational app template with streaming replies, history and a clean message composer built in." }, { title: "Retrieval Starter", description: "Starter template and sample use-cases for building document search and question answering features quickly." }, { title: "Mobile Accounts", description: "Get going with a cross-platform app by building a profile and account screen backed by a hosted database." }, { title: "Native Monorepo Starter", description: "An extended monorepo setup for shipping a mobile and web app from one shared typed codebase." }, ]; function Mark({ i, size = 20 }: { i: number; size?: number }) { const s = size; const shapes = [ <svg key="0" width={s} height={s} viewBox="0 0 20 20" aria-hidden="true"><rect x="2" y="4" width="16" height="12" rx="3" fill="var(--color-primary)" /><rect x="5" y="8" width="10" height="2" rx="1" fill="var(--color-card)" /></svg>, <svg key="1" width={s} height={s} viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="9" fill="var(--color-foreground)" /><path d="M7 14V6l6 8V6" stroke="var(--color-card)" strokeWidth="1.5" fill="none" /></svg>, <svg key="2" width={s} height={s} viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="7" fill="none" stroke="var(--color-foreground)" strokeWidth="1.5" /><circle cx="10" cy="10" r="3" fill="none" stroke="var(--color-foreground)" strokeWidth="1.5" /></svg>, <svg key="3" width={s} height={s} viewBox="0 0 20 20" aria-hidden="true"><rect x="1" y="1" width="18" height="18" rx="4" fill="var(--color-foreground)" /><path d="M7 13l6-6" stroke="var(--color-primary)" strokeWidth="2" /></svg>, <svg key="4" width={s} height={s} viewBox="0 0 20 20" aria-hidden="true"><path d="M3 17L12 3l5 7-6 7z" fill="var(--color-primary)" /></svg>, <svg key="5" width={s} height={s} viewBox="0 0 20 20" aria-hidden="true"><path d="M2 17L10 3l8 14h-4l-4-7-4 7z" fill="var(--color-foreground)" /></svg>, ]; return shapes[i % shapes.length]; } function Window({ variant }: { variant: number }) { return ( <div className="mt-auto overflow-hidden rounded-t-lg border border-b-0 border-border bg-card"> <div className="flex items-center gap-1.5 border-b border-border bg-card px-3 py-2.5"> {[0, 1, 2].map((d) => <span key={d} className="h-2.5 w-2.5 rounded-full bg-border" />)} </div> {variant === 0 ? ( <div className="flex h-[150px] justify-center bg-muted/60 pt-6"> <div className="grid w-[288px] grid-cols-3 border border-b-0 border-border bg-card"> {[0, 1, 2].map((c) => ( <div key={c} className={"flex flex-col items-center gap-1.5 border-r border-border p-2 last:border-r-0 " + (c === 1 ? "bg-primary/10" : "")}> <span className={"h-2 w-8 rounded-full " + (c === 1 ? "bg-primary/60" : "bg-border")} /> <span className={"h-2 w-16 rounded-full " + (c === 1 ? "bg-primary" : "bg-border")} /> <span className="mt-3 h-20 w-full rounded-md bg-muted" /> </div> ))} </div> </div> ) : ( <div className="flex h-[150px] bg-card"> <div className="w-[96px] shrink-0 space-y-2 border-r border-border p-3"> <span className="block h-2.5 w-2.5 rounded-full bg-primary" /> <span className="mt-4 block h-1.5 w-full rounded-full bg-border" /> <span className="block h-1.5 w-4/5 rounded-full bg-border" /> <span className="block h-1.5 w-full rounded-full bg-border" /> </div> <div className="grid flex-1 grid-cols-4 content-start gap-2 p-3"> {[1, 0, 1, 1, 1, 1, 0, 1].map((d, k) => ( <span key={k} className={"h-[56px] rounded-md " + (d ? "bg-muted" : "bg-background border border-border")} /> ))} </div> </div> )} </div> ); } export default function StarterTemplateCardGrid({ headingMuted = "Launch your next build", headingStrong = "from battle-tested starter kits", linkLabel = "Browse all templates", linkHref = "#", featured = defaultFeatured, compact = defaultCompact, }: Props) { const card = "group rounded-xl border border-border bg-card transition-colors duration-emerald-base-transition ease-emerald-base-transition hover:border-border focus-within:border-border"; return ( <section className="bg-background px-5 py-16 font-sans text-foreground md:px-10 md:py-24"> <div className="mx-auto max-w-[1088px]"> <div className="flex flex-wrap items-end justify-between gap-4"> <h2 className="font-sans text-[32px] font-medium leading-[1.1] tracking-[-0.03em] md:text-[40px]"> <span className="block text-muted-foreground">{headingMuted}</span> <span className="block text-foreground">{headingStrong}</span> </h2> <a href={linkHref} className="text-emerald-label text-muted-foreground underline underline-offset-2 transition-colors duration-emerald-hover-color ease-emerald-hover-color hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary rounded-md"> {linkLabel} </a> </div> <Stagger step={90} from="up" className="mt-12 grid gap-3 md:mt-16 md:grid-cols-2"> {featured.map((c, i) => ( <a key={c.title} href="#" className={card + " flex min-h-[375px] flex-col overflow-hidden px-6 pt-6 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary"}> <Mark i={i} size={20} /> <h3 className="mt-4 text-[14px] font-medium leading-5 text-foreground">{c.title}</h3> <p className="mt-1 mb-9 text-[14px] leading-5 text-muted-foreground">{c.description}</p> <Window variant={i} /> </a> ))} </Stagger> <Stagger step={70} from="up" className="mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4"> {compact.map((c, i) => ( <a key={c.title} href="#" className={card + " block p-6 pt-8 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary"}> <Mark i={i + 2} size={20} /> <h3 className="mt-5 text-[14px] font-medium leading-5 text-foreground">{c.title}</h3> <p className="mt-1 line-clamp-2 text-[14px] leading-5 text-muted-foreground">{c.description}</p> </a> ))} </Stagger> </div> </section> ); } // ---- Yoink motion (inlined, no dependencies): Stagger ---- 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; } /** Reveals each direct child one after another when the group scrolls into view. */ function Stagger({ children, step = 90, from = "up", distance = 20, duration = 650, delay = 0, once = true, as = "div", className, style, }: { children?: ReactNode; step?: number; from?: "up" | "down" | "left" | "right" | "scale" | "fade"; distance?: number; duration?: number; delay?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); useYkLayoutEffect(() => { const items = Array.from(ref.current?.children ?? []) as HTMLElement[]; if (state === "idle") return; 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.92)", fade: "none", }[from]; if (state === "hidden") { for (const el of items) Object.assign(el.style, { transition: "none", opacity: "0", transform: offset }); return; } items.forEach((el, i) => { const t = `${duration}ms ${YK_EASE} ${delay + i * step}ms`; Object.assign(el.style, { transition: `opacity ${t}, transform ${t}`, opacity: "", transform: "" }); }); // hand the children their own transitions back once everything has landed const done = setTimeout(() => items.forEach((el) => (el.style.transition = "")), delay + items.length * step + duration + 50); return () => clearTimeout(done); }, [state]); return ( <Tag ref={ref} className={className} style={style}> {children} </Tag> ); }
Quality checks
Automated, in a real browser · 4d ago- Accessible: passedNo serious accessibility problems (axe-core): readable contrast, labelled buttons and images.
- 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.