Breadcrumb

Indicate the current page's location within a navigational hierarchy. Separators are automatically added in CSS through ::before and content.

Overview

<template>
  <b-breadcrumb :items="items"></b-breadcrumb>
</template>

<script>
  export default {
    data() {
      return {
        items: [
          {
            text: 'Admin',
            href: '#'
          },
          {
            text: 'Manage',
            href: '#'
          },
          {
            text: 'Library',
            active: true
          }
        ]
      }
    }
  }
</script>

<!-- b-breadcrumb.vue -->

Items are rendered using :items prop. It can be an array of objects to provide link and active state. Links can be href's for anchor tags, or to's for router-links. Active state of last element is automatically set if it is undefined.

const items = [
  {
    text: 'Home',
    href: 'https://google.com'
  },
  {
    text: 'Posts',
    to: { name: 'home' }
  },
  {
    text: 'Another Story',
    active: true
  }
]

Refer to the Router support reference page for router-link specific props.

Manually placed items

You may also manually place individual <b-breadcrumb-item> child components in the default slot of the <b-breadcrumb> component, as an alternative to using the items prop, for greater control over the content of each item:

<template>
  <b-breadcrumb>
    <b-breadcrumb-item href="#home">
      <b-icon icon="house-fill" scale="1.25" shift-v="1.25" aria-hidden="true"></b-icon>
      Home
    </b-breadcrumb-item>
    <b-breadcrumb-item href="#foo">Foo</b-breadcrumb-item>
    <b-breadcrumb-item href="#bar">Bar</b-breadcrumb-item>
    <b-breadcrumb-item active>Baz</b-breadcrumb-item>
  </b-breadcrumb>
</template>

<!-- b-breadcrumb-item.vue -->

Remember to set the active prop on the last item.

<b-breadcrumb-item> also supports the various <router-link> props such as to, etc.

Component reference

Properties

PropertyTypeDefaultDescription
items
ArraynullArray of breadcrumb items to render

<b-breadcrumb-item>

Functional component

Properties

Property (Click to sort Ascending)TypeDefaultDescription
href
StringnullDenotes the target URL of the link for standard a links
rel
StringnullSets the 'rel' attribute on the rendered link
target
String'_self'Sets the 'target' attribute on the rendered link
active
BooleanfalseWhen set to 'true', places the component in the active state with active styling
disabled
BooleanfalseWhen set to 'true', disables the component's functionality and places it in a disabled state
to
String or Objectnullrouter-link prop: Denotes the target route of the link. When clicked, the value of the to prop will be passed to router.push() internally, so the value can be either a string or a Location descriptor object
append
Booleanfalserouter-link prop: Setting append prop always appends the relative path to the current path
replace
Booleanfalserouter-link prop: Setting the replace prop will call 'router.replace()' instead of 'router.push()' when clicked, so the navigation will not leave a history record
event
String or Array'click'router-link prop: Specify the event that triggers the link. In most cases you should leave this as the default
active-class
Stringrouter-link prop: Configure the active CSS class applied when the link is active. Typically you will want to set this to class name 'active'
exact
Booleanfalserouter-link prop: The default active class matching behavior is inclusive match. Setting this prop forces the mode to exactly match the route
exact-active-class
Stringrouter-link prop: Configure the active CSS class applied when the link is active with exact match. Typically you will want to set this to class name 'active'
router-tag
String'a'router-link prop: Specify which tag to render, and it will still listen to click events for navigation. 'router-tag' translates to the tag prop on the final rendered router-link. Typically you should use the default value
no-prefetch
Booleanfalsenuxt-link prop: To improve the responsiveness of your Nuxt.js applications, when the link will be displayed within the viewport, Nuxt.js will automatically prefetch the code splitted page. Setting 'no-prefetch' will disabled this feature for the specific link
text
StringnullText to render in the breadcrumb item
html
StringnullHTML string to render in the breadcrumb item. Use with caution
aria-current
String'location'Sets the value of the 'aria-current' attribute (when the item is the active item). Supported string values are 'location', 'page', or 'true'

<b-breadcrumb-item> supports generating <router-link> or <nuxt-link> component (if using Nuxt.js). For more details on the router link (or nuxt link) specific props, see the Router support reference section.

Events

EventArgumentsDescription
click
  1. event - Native click event object
Emitted when clicked

Importing individual components

You can import individual components into your project via the following named exports:

ComponentNamed ExportImport Path
<b-breadcrumb>BBreadcrumbbootstrap-vue
<b-breadcrumb-item>BBreadcrumbItembootstrap-vue

Example:

import { BBreadcrumb } from 'bootstrap-vue'
Vue.component('b-breadcrumb', BBreadcrumb)

Importing as a Vue.js plugin

This plugin includes all of the above listed individual components. Plugins also include any component aliases.

Named ExportImport Path
BreadcrumbPluginbootstrap-vue

Example:

import { BreadcrumbPlugin } from 'bootstrap-vue'
Vue.use(BreadcrumbPlugin)