Breadcrumb

A navigation component that displays the current page location within a hierarchical structure, helping users understand their position and navigate back to previous pages.

Install

Run the following command to install the breadcrumb component:

npx acc-nuxt add Breadcrumb

Basic Usage

With Icons

Custom Separator

Popover Slot

When there are more than 4 items, the breadcrumb collapses the middle items into the popover slot. The slot receives the hidden items so you can render a menu. There is a default implementation provided inside the template file, but you can customize it by providing your own content.

Current Route Highlighting

The breadcrumb automatically highlights items that match the current route. Items are automatically detected as active when their to matches the current URL, or when they are the last item without a to.

Overflow Behavior

Control how breadcrumbs behave when they exceed the container width using the overflow prop. Set to wrap (default) to wrap items to the next line, or truncate to truncate long labels with ellipsis.

Wrap (default)

Truncate

Auto Generate (Default)

The breadcrumb component automatically generates breadcrumbs from the current route by default (auto is true). The component parses the URL path and creates items for each segment, only including segments that correspond to actual Nuxt pages. Query parameters and hash fragments are automatically stripped from the links.

Customizing Auto Labels with definePageMeta

When using auto mode, you can customize breadcrumb labels for specific pages using definePageMeta. The component resolves labels in the following priority order:

  1. meta.breadcrumb (string) - Explicit breadcrumb label
  2. meta.title (string) - Page title as fallback
  3. URL segment - Formatted URL segment (e.g., "my-page" → "My Page")
<!-- pages/users/[id].vue -->
<script setup lang="ts">
definePageMeta({
  breadcrumb: 'User Details', // Highest priority
  // or
  title: 'User Profile',      // Fallback if breadcrumb not set
});
</script>

<template>
  <!-- Breadcrumb will show "User Details" instead of the dynamic :id -->
  <AcceleratorBreadcrumb />
</template>

Custom Home Label

When using auto mode, you can customize the home label using the homeLabel prop.

Slots

The breadcrumb component provides the following slots for customization.

#separator
Custom separator between breadcrumb items. Defaults to a chevron icon.
#popover
Slot for collapsed middle items when there are more than 4 items. Receives { items }.

Props

items:AccBreadcrumbItem[]— optional
default:[]
Array of breadcrumb items. Each item has label (string), to (optional string for navigation), and icon (optional Component). Required when auto is false.
auto:boolean— optional
default:true
When true (default), automatically generates breadcrumbs from the current route path. Only includes segments that match actual Nuxt pages. Labels are resolved from route meta (breadcrumb or title) or formatted URL segments.
homeLabel:string— optional
default:Home
Label for the home/root item when using auto mode.
overflow:'wrap' | 'truncate'— optional
default:truncate
Controls overflow behavior. "wrap" wraps items to next line, "truncate" truncates long labels with ellipsis.

CSS Variables

Customize the breadcrumb appearance using CSS variables.

--lev-breadcrumb-list-gap
default:8px
Gap between breadcrumb items in the list.
--lev-breadcrumb-item-gap
default:8px
Gap between item content and separator.
--lev-breadcrumb-icon-gap
default:6px
Gap between icon and label within an item.
--lev-breadcrumb-font-size
default:14px
Font size for breadcrumb labels.
--lev-breadcrumb-font-weight
default:400
Font weight for link items.
--lev-breadcrumb-link-color
default:#858787
Text color for clickable links.
--lev-breadcrumb-link-hover-color
default:#141414
Text color for links on hover.
--lev-breadcrumb-active-color
default:#141414
Text color for the current/active item.
--lev-breadcrumb-active-font-weight
default:500
Font weight for the current/active item.
--lev-breadcrumb-separator-color
default:#aaacad
Color of the separator icon.
--lev-breadcrumb-separator-size
default:16px
Size of the separator icon.
--lev-breadcrumb-icon-size
default:16px
Size of item icons.
--lev-breadcrumb-item-max-width
default:96px
Maximum width of item labels before truncating (only applies when overflow is "truncate").