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

nuxt-crumbs

v0.2.0

Published

Effortless, SSR-ready breadcrumbs for your Nuxt app.

Readme

Nuxt Crumbs 🍞

npm version npm downloads License Nuxt

Effortless, SSR-ready breadcrumbs for your Nuxt app.

A unified way to manage breadcrumbs in your Nuxt app. Define each breadcrumb on the page where its data lives, then render the full trail anywhere you like, even from a Nuxt layout! Labels can be static or derived from data fetched on the page, with full SSR support.

Features

  • 🗺️  breadcrumbs generated automatically from your route hierarchy
  • ⚡️  set crumb labels from fetched data with defineBreadcrumbs
  • 🎨  fully customizable: bring your own markup and styling
  • 🪶  lightweight and performant
  • 🌐  SSR-safe out of the box
  • 💪  fully typed, with support for augmentation

🚀 Usage

Install

  1. Install the module to your project:
npm install nuxt-crumbs
  1. Add it to your nuxt.config.ts:
export default defineNuxtConfig({
  modules: [
    'nuxt-crumbs',
  ],
})

Add a crumb to a page

The simplest way to give a page a breadcrumb is through definePageMeta. Each matched route that declares a breadcrumb becomes a segment in the trail, in hierarchy order.

<!-- pages/about.vue -->
<script setup lang="ts">
definePageMeta({
  breadcrumb: 'About',
})
</script>

Visiting /about now yields a trail of: About. Nested routes stack automatically, so pages/blog/[slug].vue under pages/blog.vue produces Blog › Post title.

Dynamic crumbs

When a label isn't known ahead of time, for example when it depends on fetched data, reach for the defineBreadcrumbs compiler macro. SSR waits for it to settle before rendering the breadcrumbs component.

<!-- pages/blog/[slug].vue -->
<script setup lang="ts">
const route = useRoute()
// we await useAsyncData 👇
const { data: post } = await useAsyncData(() => fetchPost(route.params.slug))

// `post` is now available at this point,
// we can snapshot its title into the leaf breadcrumb
defineBreadcrumbs({
  label: post.value.title
})
</script>

Passing an object sets the crumb for the current page (the leaf of the trail). For more control, pass a callback instead. It receives a context object holding the breadcrumbs already resolved from the route hierarchy, and the returned array becomes the new trail. This is handy when a crumb further up the trail also depends on fetched data.

defineBreadcrumbs(({ crumbs }) => {
  return [
    ...crumbs.map((crumb) => {
      // use the category name from fetched data
      if (crumb.routeName === 'category-slug') {
        return { ...crumb, label: product.value.category.name }
      }
      return crumb
    }),
    // append the leaf crumb
    { label: product.value.name },
  ]
})

Rendering the trail

Use the <NuxtCrumbs> component to access the trail. It exposes the resolved crumbs array through its default slot, so you can bring your own markup and styling:

<template>
  <nav aria-label="Breadcrumb">
    <ul>
      <NuxtCrumbs v-slot="{ crumbs }">
        <li v-for="(crumb, index) in crumbs" :key="crumb.label">
          <span v-if="index" aria-hidden="true">›</span>
          <NuxtLink :to="crumb.to">{{ crumb.label }}</NuxtLink>
        </li>
      </NuxtCrumbs>
    </ul>
  </nav>
</template>

The slot receives:

| Slot prop | Type | Description | | --------- | ---------------------- | ------------------------------------ | | crumbs | BreadcrumbResolved[] | The resolved breadcrumb trail. |

Each crumb is a resolved breadcrumb:

| Property | Type | Description | | ----------- | -------------------------- | ----------------------------------------------- | | label | string | The text to display. | | to | RouteLocationRaw | A route location ready to pass to <NuxtLink>. | | routeName | string \| symbol \| null | The name of the route the crumb points to. |

Custom crumb data

Sometimes a label isn't enough, you also want an icon, or some other flag to travel with each crumb. Augment the Breadcrumb interface through the #crumbs module and your extra fields flow through the whole pipeline, fully typed: from where you define them all the way to the render slot.

// index.d.ts
declare module '#crumbs' {
  interface Breadcrumb {
    icon?: string
  }
}

export {}

Set the extra data wherever you define a crumb, both definePageMeta and defineBreadcrumbs accept it:

<script setup lang="ts">
definePageMeta({
  breadcrumb: { label: 'About', icon: 'i-lucide-info' },
})

// or from the macro
defineBreadcrumbs({ label: post.value.title, icon: 'i-lucide-file' })
</script>

🧑‍💻 Contributing

  • Clone this repository
  • Install dependencies using pnpm install
  • Run pnpm dev:prepare to generate type stubs
  • Use pnpm dev to start the playground in development mode

📑 License

Published under the MIT License.