npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

breadcrumbs-kit

v1.0.0

Published

Headless, modern breadcrumbs management for Next.js, React, and TanStack Router with dynamic crumb portals, RSC support, responsive overflow collapsing, and Schema.org JSON-LD SEO.

Readme

breadcrumbs-kit

Headless, modern breadcrumb engine and UI primitives for React, Next.js (App Router / RSC), and TanStack Router with dynamic crumb portals, Schema.org JSON-LD SEO, and responsive overflow collapsing.

npm version License: MIT


✨ Features

  • ⚡️ Next.js App Router & Server Components (RSC): Native support for Server Components (getServerBreadcrumbs), stripping route groups like (dashboard) or (auth) automatically.
  • 🎯 Declarative Crumb Teleportation (<Crumb />): Deep child components can register or override crumb labels/icons without prop-drilling into top-level layouts.
  • 🔍 First-Class SEO (Schema.org JSON-LD): Auto-generates valid Google-compliant BreadcrumbList structured data.
  • 🪓 Responsive Overflow & Collapsing: Headless hook (useBreadcrumbOverflow) to auto-collapse long trails into clean ellipsis popovers (...).
  • 🔄 Async Route Resolvers: Resolve database IDs (/projects/:id) to human-readable names with built-in loading states and SWR/React Query caching compatibility.
  • 🎨 100% Headless: Works seamlessly with Tailwind CSS, shadcn/ui, Radix, MUI, Chakra, or custom CSS.
  • 📦 Zero-Config & Type-Safe: Pure TypeScript with full ESM and CJS bundles.

📦 Installation

npm install breadcrumbs-kit
# or
pnpm add breadcrumbs-kit
# or
yarn add breadcrumbs-kit

🚀 Quick Start

1. Wrap your app with BreadcrumbsProvider

// app/layout.tsx or src/App.tsx
import { BreadcrumbsProvider } from 'breadcrumbs-kit/react';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        <BreadcrumbsProvider>
          <MyBreadcrumbNav />
          {children}
        </BreadcrumbsProvider>
      </body>
    </html>
  );
}

2. Build your Breadcrumb UI component

'use client';
import { useNextBreadcrumbs } from 'breadcrumbs-kit/next';
import { useBreadcrumbOverflow, BreadcrumbJsonLd } from 'breadcrumbs-kit/react';
import Link from 'next/link';

export function MyBreadcrumbNav() {
  const { items, isLoading } = useNextBreadcrumbs({
    resolvers: {
      '/projects/:id': async ({ id }) => {
        const res = await fetch(`/api/projects/${id}`);
        const data = await res.json();
        return data.name;
      },
    },
  });

  const { items: visibleItems, isCollapsed, collapsedItems } = useBreadcrumbOverflow({
    items,
    maxItems: 4,
  });

  return (
    <>
      {/* Schema.org SEO Structured Data */}
      <BreadcrumbJsonLd items={items} baseUrl="https://yourdomain.com" />

      <nav aria-label="Breadcrumb" className="flex items-center space-x-2 text-sm text-gray-600">
        {visibleItems.map((item, index) => (
          <span key={item.key} className="inline-flex items-center">
            {index > 0 && <span className="mx-2 text-gray-400">/</span>}
            
            {item.disabled ? (
              <span className="text-gray-400 font-medium">{item.label}</span>
            ) : item.isCurrent ? (
              <span className="text-gray-900 font-semibold">{item.label}</span>
            ) : (
              <Link href={item.href} className="hover:text-blue-600">
                {item.label}
              </Link>
            )}
          </span>
        ))}
      </nav>
    </>
  );
}

3. Declarative Crumb Portals (<Crumb />)

Need a nested page or modal to change the breadcrumb label dynamically? Just drop <Crumb /> in your page:

// app/projects/[id]/page.tsx
import { Crumb } from 'breadcrumbs-kit/react';

export default async function ProjectPage({ params }: { params: { id: string } }) {
  const project = await getProject(params.id);

  return (
    <div>
      <Crumb
        label={project.name}
        href={`/projects/${project.id}`}
        icon={<FolderIcon className="w-4 h-4 mr-1" />}
      />
      <h1 className="text-2xl font-bold">{project.name}</h1>
    </div>
  );
}

⚡️ Next.js Server Components (RSC) & SEO

For purely static pages or generating SEO metadata directly on the server without any client hydration:

import { getServerBreadcrumbs, generateServerBreadcrumbsJsonLd } from 'breadcrumbs-kit/next';

export async function generateMetadata({ params }) {
  const jsonLd = await generateServerBreadcrumbsJsonLd(`/projects/${params.id}`, {
    baseUrl: 'https://example.com',
    resolvers: {
      '/projects/:id': async () => 'Custom Project Name',
    },
  });

  return {
    other: {
      'script:ld+json': JSON.stringify(jsonLd),
    },
  };
}

🛠 API Reference

Core & React Exports

  • useBreadcrumbs(options)
  • useNextBreadcrumbs(options)
  • useBreadcrumbOverflow(options)
  • <BreadcrumbsProvider>
  • <Crumb label="..." href="..." icon="..." />
  • <BreadcrumbJsonLd items={...} baseUrl="..." />
  • getServerBreadcrumbs(pathname, options)
  • formatSlugToTitle(segment)
  • generateBreadcrumbJsonLd(items, options)

📄 License

MIT © Antigravity Open Source