Page sections / Blog & articles

Blog Post Card Grid

Three-column grid of text-only cards on #111214 with hairline border, 12px radius, medium white title, grey clamped excerpt, avatar stack and mono date in the footer.

Rebuilt from raycast.com/blog in the Obsidian Launcher style.

npx shadcn@latest add https://justyoink.it/r/obsidian-launcher/blocks/blog-post-grid.json

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

Usage

Pass a `posts` array of {title, excerpt, date, authors (initials plus gradient colors), href}. It renders a responsive 1/2/3-column grid with no props, cards lighten in 100ms on hover and excerpts clamp to two lines.

components/blog-post-grid.tsx
"use client";

import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react";
type Author = { initials: string; from: string; to: string };
type Post = { title: string; excerpt: string; date: string; authors: Author[]; href?: string };

const A: Record<string, Author> = {
  m: { initials: "MK", from: "#9c9c9d", to: "#3a3b3d" },
  o: { initials: "JT", from: "#f2a65a", to: "#8a4b12" },
  b: { initials: "AL", from: "#6aa5e8", to: "#2b4a73" },
  g: { initials: "RS", from: "#6fcf97", to: "#1f5a3a" },
  r: { initials: "PN", from: "#ff6363", to: "#7a1f1f" },
};

const defaultPosts: Post[] = [
  { title: "Introducing Kitefield Canvas", excerpt: "A shared whiteboard that turns rough sketches into tidy diagrams while your team talks, with no setup needed at all.", date: "July 8, 2026", authors: [A.m, A.o] },
  { title: "Inside the Rebuilt Sync Engine and How It Stays Fast", excerpt: "The reasoning behind our new offline-first storage layer and the tradeoffs we weighed along the way to shipping it.", date: "May 19, 2026", authors: [A.o, A.b] },
  { title: "Northwind for Android", excerpt: "Our planner now fits in your pocket, ready for the commute.", date: "May 19, 2026", authors: [A.m] },
  { title: "Altura Reports Are Here", excerpt: "Build clear weekly summaries in minutes by picking a few metrics and letting the builder lay them out for you.", date: "March 12, 2026", authors: [A.m, A.g] },
  { title: "Lumen on Linux", excerpt: "Faster startup, smaller footprint. Lumen is now available in open beta for every major distribution.", date: "November 14, 2025", authors: [A.b, A.r] },
  { title: "Kitefield for Tablets", excerpt: "Stay on top of tasks and notes whichever screen you pick up.", date: "April 22, 2025", authors: [A.o] },
  { title: "Meet the redesigned Journal editor", excerpt: "A calm, quick and distraction-free writing space.", date: "November 2, 2024", authors: [A.g] },
  { title: "$20M Series B to grow Northwind worldwide", excerpt: "We are announcing new funding to bring Northwind to more teams and more languages", date: "September 18, 2024", authors: [A.m] },
  { title: "Launching our Partner Network", excerpt: "Earn a recurring share of revenue from every team you refer to our platform and help them get started quickly.", date: "July 9, 2024", authors: [A.r] },
  { title: "The Support Crew", excerpt: "Say hello to the folks answering your questions, writing guides, and testing releases.", date: "June 11, 2024", authors: [A.g] },
  { title: "One workspace, many models", excerpt: "Altura assistant now works with several leading language models so you can pick the right one for each task.", date: "April 3, 2024", authors: [A.m] },
  { title: "Best Plugins for Product Managers", excerpt: "A hand-picked list of plugins that help planners ship roadmaps and keep stakeholders in the loop every week.", date: "March 6, 2024", authors: [A.b] },
];

export default function BlogPostCardGrid({ posts = defaultPosts }: { posts?: Post[] }) {
  return (
    <section className="bg-canvas px-4 py-16 font-sans">
      <Stagger step={60} from="up" distance={16} className="mx-auto grid max-w-[1000px] gap-6 md:grid-cols-2 lg:grid-cols-3">
        {posts.map((p, i) => (
          <a
            key={i}
            href={p.href ?? "#"}
            className="flex min-h-[174px] flex-col justify-between rounded-xl border border-hairline bg-surface p-6 transition-colors duration-100 ease-out hover:bg-surface-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent-red"
          >
            <div>
              <h3 className="text-[18px] font-medium leading-7 tracking-[0.01em] text-primary">{p.title}</h3>
              <p className="mt-1 line-clamp-2 text-[14px] leading-[23px] text-tertiary">{p.excerpt}</p>
            </div>
            <div className="mt-6 flex items-center justify-between">
              <div className="flex -space-x-0 gap-2">
                {p.authors.map((a, j) => (
                  <span
                    key={j}
                    aria-label={a.initials}
                    className="flex h-[21px] w-[21px] items-center justify-center rounded-full text-[8px] font-medium text-primary ring-1 ring-white/10"
                    style={{ background: `linear-gradient(135deg, ${a.from}, ${a.to})` }}
                  >
                    {a.initials}
                  </span>
                ))}
              </div>
              <time className="font-mono text-[12px] uppercase tracking-wide text-tertiary">{p.date}</time>
            </div>
          </a>
        ))}
      </Stagger>
    </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
—

More from Obsidian Launcher

The whole style →

AI Agent Bento Showcase

Feature sections

Blog Category Filter Row

Tab bars

Frosted Pill Navbar

Headers & nav bars

Centered Glow Hero

Heroes

Light Pill Download Button

Buttons

Launcher Window Showcase

Media & mockups