Skip to content

Breadcrumbs

Navigation trail rendered as router links inside a labelled <nav>, with a chevron between the levels.

Import

typescript
import { Breadcrumbs } from 'vuiii'
import type { BreadcrumbItems } from 'vuiii'

Basic Usage

Every item is a link, and link is required on each. The last one additionally carries aria-current="page", so assistive technology knows which level is the page being viewed.

vue
<script setup>
import type { BreadcrumbItems } from 'vuiii'

const breadcrumbs: BreadcrumbItems = [
  { label: 'Home', link: '/' },
  { label: 'Products', link: '/products' },
  { label: 'Electronics', link: '/products/electronics' },
]
</script>

<template>
  <Breadcrumbs :breadcrumbs="breadcrumbs" />
</template>

Props

PropTypeDefaultDescription
breadcrumbsBreadcrumbItems[]The trail, root first
ts
type BreadcrumbItems = {
  label: string
  link: string | RouteLocationRaw
}[]

Named Routes

link takes anything router-link accepts, so named routes with params work as well as paths.

vue
<script setup>
const breadcrumbs: BreadcrumbItems = [
  { label: 'Dashboard', link: { name: 'dashboard' } },
  { label: 'Users', link: { name: 'users' } },
  { label: 'John Doe', link: { name: 'user', params: { id: 123 } } },
]
</script>

<template>
  <Breadcrumbs :breadcrumbs="breadcrumbs" />
</template>

A Single Level

One item renders on its own, with no chevron.

Requires vue-router

The links render as router-link, so this component needs vue-router registered in your app. See Requirements.

Storybook

For interactive examples with all variants, see Breadcrumbs in Storybook.

Released under the MIT License.