Skip to content

Blog 1

Three-column blog grid with cover images, categories, read time and authors.

01 / 02

Installation

Run this in a project that already uses shadcn/ui. The CLI adds the block, its components and npm dependencies.

pnpm dlx shadcn@latest add https://ui.sumansharma.info.np/r/blog-1.json
Prefer to iterate with AI?Open in

Usage

The CLI writes the block to components/blog-1.tsx. Import it anywhere:

Loading...

Source

The CLI writes this component to components/blog-1.tsx.

import Link from 'next/link'
import { ArrowUpRight } from 'lucide-react'

const posts = [
    {
        title: 'Shipping a design system in six weeks',
        excerpt: 'How a three-person team replaced four component libraries with one, without freezing product work.',
        category: 'Engineering',
        date: 'Nov 4, 2026',
        readTime: '8 min read',
        image: 'https://images.unsplash.com/photo-1498050108023-c5249f4df085?auto=format&fit=crop&w=1200&q=80',
        author: { name: 'Maya Chen', avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?auto=format&fit=crop&w=96&h=96&q=80' },
    },
    {
        title: 'The case for boring infrastructure',
        excerpt: 'Fewer moving parts, fewer pages at 3am. What we learned moving our stack back to Postgres.',
        category: 'Infrastructure',
        date: 'Oct 22, 2026',
        readTime: '6 min read',
        image: 'https://images.unsplash.com/photo-1555066931-4365d14bab8c?auto=format&fit=crop&w=1200&q=80',
        author: { name: 'Jonathan Yombo', avatar: 'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?auto=format&fit=crop&w=96&h=96&q=80' },
    },
    {
        title: 'Writing onboarding that people finish',
        excerpt: 'We cut our setup flow from eleven steps to three and doubled activation. Here is the playbook.',
        category: 'Product',
        date: 'Oct 9, 2026',
        readTime: '5 min read',
        image: 'https://images.unsplash.com/photo-1519389950473-47ba0277781c?auto=format&fit=crop&w=1200&q=80',
        author: { name: 'Priya Natarajan', avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?auto=format&fit=crop&w=96&h=96&q=80' },
    },
]

export default function BlogSection() {
    return (
        <section className="py-16 md:py-24">
            <div className="mx-auto max-w-6xl px-6">
                <div className="flex flex-wrap items-end justify-between gap-6">
                    <div className="max-w-xl">
                        <h2 className="text-balance text-4xl font-semibold lg:text-5xl">From the blog</h2>
                        <p className="text-muted-foreground mt-4">Notes on building products, scaling teams and the craft of software.</p>
                    </div>
                    <Link
                        href="#"
                        className="group inline-flex items-center gap-1 text-sm font-medium">
                        View all posts
                        <ArrowUpRight className="size-4 transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5" />
                    </Link>
                </div>

                <ul className="mt-12 grid gap-x-6 gap-y-12 md:grid-cols-2 lg:grid-cols-3">
                    {posts.map((post) => (
                        <li key={post.title}>
                            <article className="group relative flex h-full flex-col">
                                <div className="bg-muted relative aspect-[16/10] overflow-hidden rounded-xl">
                                    <img
                                        src={post.image}
                                        alt=""
                                        loading="lazy"
                                        className="size-full object-cover transition-transform duration-500 group-hover:scale-105"
                                    />
                                    <span className="bg-background/80 absolute left-3 top-3 rounded-full px-2.5 py-1 text-xs font-medium backdrop-blur">{post.category}</span>
                                </div>
                                <div className="text-muted-foreground mt-5 flex items-center gap-2 text-xs">
                                    <time>{post.date}</time>
                                    <span aria-hidden>·</span>
                                    <span>{post.readTime}</span>
                                </div>
                                <h3 className="mt-2 text-lg font-semibold leading-snug">
                                    <Link
                                        href="#"
                                        className="decoration-foreground/30 underline-offset-4 group-hover:underline">
                                        {/* Stretched link: the whole card is clickable, but only the title is announced. */}
                                        <span className="absolute inset-0" />
                                        {post.title}
                                    </Link>
                                </h3>
                                <p className="text-muted-foreground mt-2 line-clamp-2 text-sm">{post.excerpt}</p>
                                <div className="mt-auto flex items-center gap-2.5 pt-5">
                                    <img
                                        src={post.author.avatar}
                                        alt=""
                                        loading="lazy"
                                        className="size-7 rounded-full object-cover"
                                    />
                                    <span className="text-sm font-medium">{post.author.name}</span>
                                </div>
                            </article>
                        </li>
                    ))}
                </ul>
            </div>
        </section>
    )
}