Nested Initiatives Table
Dark data table in a floating window with pill tabs (Active, Planned, All), muted column headers, tree-indented rows with coloured icons, health status text (green, yellow, red), progress counts and dot stats. Lower rows fade out.
Rebuilt from linear.app/plan in the Obsidian Precision style.
Looks exactly like linear.app: 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: heading, lead, caption, captionBody, tabs (string[]) and rows (array with name, sub, depth, color, target, health, done, total, dots, trend). Renders standalone with defaults; tabs are clickable pills.
components/initiatives-table.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useState } from "react"; type Row = { name: string; sub?: string; depth: number; color: string; target: string; health: "On track" | "At risk" | "Off track"; done: number; total: number; dots: [string, number][]; trend: boolean }; const defaultRows: Row[] = [ { name: "Platform", depth: 0, color: "#22b8cf", target: "2026", health: "On track", done: 23, total: 102, dots: [["s", 28], ["w", 8], ["n", 4]], trend: true }, { name: "Reliability", depth: 1, color: "#22b8cf", target: "2026", health: "On track", done: 41, total: 193, dots: [["s", 83], ["n", 12]], trend: true }, { name: "Automation", depth: 1, color: "#22b8cf", target: "2026", health: "At risk", done: 51, total: 205, dots: [["s", 98], ["w", 10], ["n", 24]], trend: true }, { name: "Forecasting", sub: "Models and planning signals for teams", depth: 2, color: "#22b8cf", target: "Q3 2026", health: "Off track", done: 12, total: 85, dots: [["s", 12], ["n", 35]], trend: false }, { name: "Security", sub: "Audits, access reviews, and recovery", depth: 2, color: "#22b8cf", target: "H1 2026", health: "On track", done: 22, total: 65, dots: [["s", 24], ["n", 24]], trend: true }, { name: "Companion app", depth: 1, color: "#22b8cf", target: "Q1 2026", health: "On track", done: 8, total: 127, dots: [["s", 79]], trend: false }, { name: "Regional growth", depth: 0, color: "#f4623a", target: "2026", health: "On track", done: 14, total: 32, dots: [["s", 22], ["n", 2]], trend: true }, { name: "Market entry", depth: 1, color: "#f4623a", target: "Q2 2026", health: "On track", done: 2, total: 15, dots: [["s", 9], ["n", 2]], trend: true }, { name: "Partner outreach", depth: 1, color: "#f4623a", target: "H2 2026", health: "At risk", done: 4, total: 18, dots: [["s", 6], ["w", 1], ["n", 2]], trend: true }, ]; const hc = { "On track": "text-success", "At risk": "text-warning", "Off track": "text-danger" } as const; const dc: Record<string, string> = { s: "bg-success", w: "bg-warning", n: "bg-quaternary" }; export default function NestedInitiativesTable({ heading = "Coordinate strategic product initiatives", lead = "Group projects into larger, strategic efforts. Show the key streams of work across your company and how each one is moving along.", caption = "Make strategic work legible at a glance", captionBody = "A single entry point that keeps everyone aligned on the most important efforts in your company.", tabs = ["Active", "Planned", "All initiatives"], rows = defaultRows, }: { heading?: string; lead?: string; caption?: string; captionBody?: string; tabs?: string[]; rows?: Row[] }) { const [tab, setTab] = useState(0); const cols = "grid-cols-[minmax(180px,1fr)_100px_140px_140px_150px_60px]"; return ( <section className="bg-canvas px-4 py-16 font-sans text-primary md:px-12"> <div className="mx-auto grid max-w-[1344px] gap-8 md:grid-cols-2 md:px-8"> <h2 className="text-h1 text-4xl font-medium tracking-[-0.03em] md:pt-8 md:text-5xl">{heading}</h2> <div> <p className="max-w-[480px] text-xl leading-8 text-secondary">{lead}</p> <p className="mt-8 text-ui text-tertiary">Initiatives +</p> </div> </div> <Reveal className="mx-auto mt-16 max-w-[1344px]"> <div className="relative overflow-hidden rounded-lg border border-hairline bg-canvas"> <div className="absolute inset-0 bg-[radial-gradient(60%_40%_at_50%_0%,rgba(255,255,255,0.28),transparent),linear-gradient(to_bottom,rgba(255,255,255,0.08),transparent_70%)]" /> <div className="relative px-4 pt-12 md:px-[112px] md:pt-24"> <div className="relative overflow-hidden rounded-lg border border-hairline bg-surface [mask-image:linear-gradient(to_bottom,#000_55%,transparent_95%)]"> <div className="flex gap-2 p-3"> {tabs.map((t, i) => ( <button key={t} onClick={() => setTab(i)} className={`rounded-pill border px-3 py-1 text-xs transition-colors duration-hover-fill focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent-indigo ${i === tab ? "border-hairline bg-surface-raised text-primary" : "border-hairline-subtle text-tertiary hover:bg-surface-raised hover:text-primary"}`}>{t}</button> ))} </div> <div className="overflow-x-auto"> <div className="min-w-[860px] px-8 pb-24"> <div className={`grid ${cols} items-center border-b border-hairline-subtle py-4 text-xs text-quaternary`}> <span>Name</span><span>Target</span><span>Health</span><span>Projects</span><span>Active projects</span><span>Activity</span> </div> {rows.map((r, i) => ( <div key={i} className={`grid ${cols} h-14 items-center text-[13px] ${r.depth === 0 && i > 0 ? "mt-6 border-t border-hairline-subtle pt-6" : ""}`}> <div className="flex items-center gap-3" style={{ paddingLeft: r.depth * 20 }}> <span className="h-4 w-4 shrink-0 rounded-full border-2" style={{ borderColor: r.color }} /> <div><div className="text-primary">{r.name}</div>{r.sub && <div className="text-xs text-tertiary">{r.sub}</div>}</div> </div> <span className="font-mono text-xs text-tertiary">{r.target}</span> <span className={`flex items-center gap-1.5 ${hc[r.health]}`}><span className="h-3 w-3 rounded-full bg-current opacity-40" />{r.health}</span> <span className="flex items-center gap-2 font-mono text-xs text-tertiary"><span className="h-3 w-3 rounded-sm bg-accent-indigo/60" />{r.done} / {r.total}</span> <span className="flex items-center gap-3 font-mono text-xs text-tertiary"> {r.dots.map(([k, n], j) => (<span key={j} className="flex items-center gap-1.5"><span className={`h-2 w-2 rounded-full ${dc[k]}`} />{n}</span>))} </span> <span className={r.trend ? "text-success" : "text-quaternary"}>{r.trend ? "\u2191" : "\u2014"}</span> </div> ))} </div> </div> </div> </div> <div className="relative mt-16 px-5 pb-8 md:px-8"> <h3 className="text-ui font-medium text-primary">{caption}</h3> <p className="mt-1 max-w-md text-ui text-tertiary">{captionBody}</p> </div> </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> ); }"use client"; import { useEffect, useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useState } from "react"; type Row = { name: string; sub?: string; depth: number; color: string; target: string; health: "On track" | "At risk" | "Off track"; done: number; total: number; dots: [string, number][]; trend: boolean }; const defaultRows: Row[] = [ { name: "Platform", depth: 0, color: "#22b8cf", target: "2026", health: "On track", done: 23, total: 102, dots: [["s", 28], ["w", 8], ["n", 4]], trend: true }, { name: "Reliability", depth: 1, color: "#22b8cf", target: "2026", health: "On track", done: 41, total: 193, dots: [["s", 83], ["n", 12]], trend: true }, { name: "Automation", depth: 1, color: "#22b8cf", target: "2026", health: "At risk", done: 51, total: 205, dots: [["s", 98], ["w", 10], ["n", 24]], trend: true }, { name: "Forecasting", sub: "Models and planning signals for teams", depth: 2, color: "#22b8cf", target: "Q3 2026", health: "Off track", done: 12, total: 85, dots: [["s", 12], ["n", 35]], trend: false }, { name: "Security", sub: "Audits, access reviews, and recovery", depth: 2, color: "#22b8cf", target: "H1 2026", health: "On track", done: 22, total: 65, dots: [["s", 24], ["n", 24]], trend: true }, { name: "Companion app", depth: 1, color: "#22b8cf", target: "Q1 2026", health: "On track", done: 8, total: 127, dots: [["s", 79]], trend: false }, { name: "Regional growth", depth: 0, color: "#f4623a", target: "2026", health: "On track", done: 14, total: 32, dots: [["s", 22], ["n", 2]], trend: true }, { name: "Market entry", depth: 1, color: "#f4623a", target: "Q2 2026", health: "On track", done: 2, total: 15, dots: [["s", 9], ["n", 2]], trend: true }, { name: "Partner outreach", depth: 1, color: "#f4623a", target: "H2 2026", health: "At risk", done: 4, total: 18, dots: [["s", 6], ["w", 1], ["n", 2]], trend: true }, ]; const hc = { "On track": "text-obsidian-success", "At risk": "text-obsidian-warning", "Off track": "text-destructive" } as const; const dc: Record<string, string> = { s: "bg-obsidian-success", w: "bg-obsidian-warning", n: "bg-foreground" }; export default function NestedInitiativesTable({ heading = "Coordinate strategic product initiatives", lead = "Group projects into larger, strategic efforts. Show the key streams of work across your company and how each one is moving along.", caption = "Make strategic work legible at a glance", captionBody = "A single entry point that keeps everyone aligned on the most important efforts in your company.", tabs = ["Active", "Planned", "All initiatives"], rows = defaultRows, }: { heading?: string; lead?: string; caption?: string; captionBody?: string; tabs?: string[]; rows?: Row[] }) { const [tab, setTab] = useState(0); const cols = "grid-cols-[minmax(180px,1fr)_100px_140px_140px_150px_60px]"; return ( <section className="bg-background px-4 py-16 font-sans text-foreground md:px-12"> <div className="mx-auto grid max-w-[1344px] gap-8 md:grid-cols-2 md:px-8"> <h2 className="text-obsidian-h1 text-4xl font-medium tracking-[-0.03em] md:pt-8 md:text-5xl">{heading}</h2> <div> <p className="max-w-[480px] text-xl leading-8 text-muted-foreground">{lead}</p> <p className="mt-8 text-obsidian-ui text-muted-foreground">Initiatives +</p> </div> </div> <Reveal className="mx-auto mt-16 max-w-[1344px]"> <div className="relative overflow-hidden rounded-lg border border-border bg-background"> <div className="absolute inset-0 bg-[radial-gradient(60%_40%_at_50%_0%,rgba(255,255,255,0.28),transparent),linear-gradient(to_bottom,rgba(255,255,255,0.08),transparent_70%)]" /> <div className="relative px-4 pt-12 md:px-[112px] md:pt-24"> <div className="relative overflow-hidden rounded-lg border border-border bg-card [mask-image:linear-gradient(to_bottom,#000_55%,transparent_95%)]"> <div className="flex gap-2 p-3"> {tabs.map((t, i) => ( <button key={t} onClick={() => setTab(i)} className={`rounded-full border px-3 py-1 text-xs transition-colors duration-obsidian-hover-fill focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${i === tab ? "border-border bg-secondary text-foreground" : "border-border text-muted-foreground hover:bg-secondary hover:text-foreground"}`}>{t}</button> ))} </div> <div className="overflow-x-auto"> <div className="min-w-[860px] px-8 pb-24"> <div className={`grid ${cols} items-center border-b border-border py-4 text-xs text-muted-foreground`}> <span>Name</span><span>Target</span><span>Health</span><span>Projects</span><span>Active projects</span><span>Activity</span> </div> {rows.map((r, i) => ( <div key={i} className={`grid ${cols} h-14 items-center text-[13px] ${r.depth === 0 && i > 0 ? "mt-6 border-t border-border pt-6" : ""}`}> <div className="flex items-center gap-3" style={{ paddingLeft: r.depth * 20 }}> <span className="h-4 w-4 shrink-0 rounded-full border-2" style={{ borderColor: r.color }} /> <div><div className="text-foreground">{r.name}</div>{r.sub && <div className="text-xs text-muted-foreground">{r.sub}</div>}</div> </div> <span className="font-mono text-xs text-muted-foreground">{r.target}</span> <span className={`flex items-center gap-1.5 ${hc[r.health]}`}><span className="h-3 w-3 rounded-full bg-current opacity-40" />{r.health}</span> <span className="flex items-center gap-2 font-mono text-xs text-muted-foreground"><span className="h-3 w-3 rounded-sm bg-primary/60" />{r.done} / {r.total}</span> <span className="flex items-center gap-3 font-mono text-xs text-muted-foreground"> {r.dots.map(([k, n], j) => (<span key={j} className="flex items-center gap-1.5"><span className={`h-2 w-2 rounded-full ${dc[k]}`} />{n}</span>))} </span> <span className={r.trend ? "text-obsidian-success" : "text-muted-foreground"}>{r.trend ? "\u2191" : "\u2014"}</span> </div> ))} </div> </div> </div> </div> <div className="relative mt-16 px-5 pb-8 md:px-8"> <h3 className="text-obsidian-ui font-medium text-foreground">{caption}</h3> <p className="mt-1 max-w-md text-obsidian-ui text-muted-foreground">{captionBody}</p> </div> </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- Accessible: not passedElements must meet minimum color contrast ratio thresholds (6 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: not passed2 hard-coded colours (#22b8cf, #f4623a). These ignore the theme and break dark mode.
- Animates cleanly: passedIts animation plays and finishes with everything visible, and it stays still for people who turn on reduced motion.