Skip to content

Breadcrumb

The Breadcrumb is a simple navigational component that indicates the location of the current page within a list to parent pages in the navigation hierarchy. It helps users find their place within a website or web application. Breadcrumbs are often placed horizontally in front of the main content of a page. The elements are split by a sperator, either by css or by a given string. The component implements the W3C ARIA APG Breadcrumb Pattern.

Examples

Base

Since breadcrumbs provide a navigation, it's a good idea to add a meaningful label such as aria-label="breadcrumb" to describe the type of navigation provided in the nav element. To determine the current page, set the active prop. This applies an aria-current="page" to the item to indicate that it represents the current page. Individual items can also be disabled using the disabled prop.

html
<section>
    <o-breadcrumb>
        <o-breadcrumb-item disabled> Home </o-breadcrumb-item>
        <o-breadcrumb-item href="/"> Docs </o-breadcrumb-item>
        <o-breadcrumb-item href="/components/Breadcrumb.html" active>
            Breadcrumb
        </o-breadcrumb-item>
    </o-breadcrumb>
</section>

Separators

Dividers are automatically added in CSS by the theme. In addition, the component allows you to customise the seperator using the seperator prop. The seperator slot can be used if further customisation is needed.

html
<section>
    <!-- Separatoer slash -->
    <o-breadcrumb separator="/">
        <o-breadcrumb-item label="Home" />
        <o-breadcrumb-item label="Docs" disabled />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>

    <!-- Separatoer dot -->
    <o-breadcrumb separator="•">
        <o-breadcrumb-item label="Home" />
        <o-breadcrumb-item label="Docs" disabled />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>

    <!-- Separatoer chevron -->
    <o-breadcrumb separator="≻">
        <o-breadcrumb-item label="Home" />
        <o-breadcrumb-item label="Docs" disabled />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>

    <!-- Separatoer arrow -->
    <o-breadcrumb separator="→">
        <o-breadcrumb-item label="Home" />
        <o-breadcrumb-item label="Docs" disabled />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>
</section>

Options

Instead of using the <o-breadcrumb-item> component directly inside the default template slot, an options prop can be set, which allows the options to be set programmatically. It accepts several different value formats:

  • An array of primitives ['A', 'B', 'C']
  • An object literal with key-value pairs { a: 'A', b: 'B', c: 'C' }
  • An array of objects where each object represent an item
html
<section>
    <o-breadcrumb :options="options" />
</section>
javascript
import type { BreadcrumnOptions } from "@oruga-ui/oruga-next";

const options: BreadcrumnOptions = [
    {
        label: "Home",
        href: "/",
        disabled: true,
    },
    {
        label: "Docs",
    },
    {
        label: "Breadcrumb",
        active: true,
    },
];

Variants

Different styles can be achieved with the variant prop.

html
<section>
    <!-- Variant primary -->
    <o-breadcrumb variant="primary">
        <o-breadcrumb-item label="Home" disabled />
        <o-breadcrumb-item label="Docs" href="/" />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>

    <!-- Variant secondary -->
    <o-breadcrumb variant="secondary">
        <o-breadcrumb-item label="Home" disabled />
        <o-breadcrumb-item label="Docs" href="/" />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>

    <!-- Variant success -->
    <o-breadcrumb variant="success">
        <o-breadcrumb-item label="Home" disabled />
        <o-breadcrumb-item label="Docs" href="/" />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>

    <!-- Variant info -->
    <o-breadcrumb variant="info">
        <o-breadcrumb-item label="Home" disabled />
        <o-breadcrumb-item label="Docs" href="/" />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>

    <!-- Variant warning -->
    <o-breadcrumb variant="warning">
        <o-breadcrumb-item label="Home" disabled />
        <o-breadcrumb-item label="Docs" href="/" />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>

    <!-- Variant danger -->
    <o-breadcrumb variant="danger">
        <o-breadcrumb-item label="Home" disabled />
        <o-breadcrumb-item label="Docs" href="/" />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>
</section>

Sizes

The component can be displayed in different sizes using the size prop.

html
<section>
    <!-- Size small -->
    <o-breadcrumb size="small">
        <o-breadcrumb-item label="Home" href="/" />
        <o-breadcrumb-item label="Docs" disabled />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>

    <!-- Size default -->
    <o-breadcrumb>
        <o-breadcrumb-item label="Home" href="/" />
        <o-breadcrumb-item label="Docs" disabled />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>

    <!-- Size medium -->
    <o-breadcrumb size="medium">
        <o-breadcrumb-item label="Home" href="/" />
        <o-breadcrumb-item label="Docs" disabled />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>

    <!-- Size large -->
    <o-breadcrumb size="large">
        <o-breadcrumb-item label="Home" href="/" />
        <o-breadcrumb-item label="Docs" disabled />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>
</section>

Positions

For alternative alignments, the breadcrumb can be positioned by the position prop.

html
<section>
    <!-- Position left -->
    <o-breadcrumb position="left">
        <o-breadcrumb-item label="Home" disabled />
        <o-breadcrumb-item label="Docs" />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>

    <!-- Position center -->
    <o-breadcrumb position="centered">
        <o-breadcrumb-item label="Home" disabled />
        <o-breadcrumb-item label="Docs" />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>

    <!-- Position right -->
    <o-breadcrumb position="right">
        <o-breadcrumb-item label="Home" disabled />
        <o-breadcrumb-item label="Docs" />
        <o-breadcrumb-item label="Breadcrumb" active />
    </o-breadcrumb>
</section>

Icons

You can add an icon to the item to explain its function more visually.

html
<section>
    <o-field grouped>
        <o-field label="Icon Size">
            <o-select v-model="iconSize">
                <option value="small">Small</option>
                <option value="">Default</option>
                <option value="medium">Medium</option>
                <option value="large">Large</option>
            </o-select>
        </o-field>

        <o-field label="Text Size">
            <o-select v-model="size">
                <option value="small">Small</option>
                <option value="">Default</option>
                <option value="medium">Medium</option>
                <option value="large">Large</option>
            </o-select>
        </o-field>
    </o-field>

    <o-breadcrumb :size="size">
        <o-breadcrumb-item
            label="Home"
            icon-left="home"
            :icon-size="iconSize" />
        <o-breadcrumb-item
            label="Docs"
            icon-left="plus"
            :icon-size="iconSize" />
        <o-breadcrumb-item
            label="Breadcrumb"
            icon-left="location"
            :icon-size="iconSize"
            active />
    </o-breadcrumb>

    <o-breadcrumb :size="size">
        <o-breadcrumb-item
            label="Home"
            icon-right="home"
            :icon-size="iconSize" />
        <o-breadcrumb-item
            label="Docs"
            icon-right="plus"
            :icon-size="iconSize" />
        <o-breadcrumb-item
            label="Breadcrumb"
            icon-right="location"
            :icon-size="iconSize"
            active />
    </o-breadcrumb>
</section>
javascript
import { ref } from "vue";

const iconSize = ref<string>("");
const size = ref<string>("");

Tags

By default the breadcrumb items are represented as HTML a tag elements. The HTML tag can be customised using the tag prop for an item, for example to define links using vue-router and router-link tag.

html
<section>
    <!-- remove links -->
    <o-breadcrumb separator="->">
        <o-breadcrumb-item label="Home" tag="a" href="/" disabled />
        <o-breadcrumb-item label="Docs" tag="a" href="/documentation/" />
        <o-breadcrumb-item
            label="Breadcrumb"
            tag="a"
            href="/components/Breadcrumb.html"
            active />
    </o-breadcrumb>

    <!-- need vue-router -->
    <o-breadcrumb separator="/">
        <o-breadcrumb-item label="Home" tag="router-link" to="/" disabled />
        <o-breadcrumb-item
            label="Docs"
            tag="router-link"
            to="/documentation/" />
        <o-breadcrumb-item
            label="Breadcrumb"
            tag="router-link"
            to="/components/Breadcrumb"
            active />
    </o-breadcrumb>
</section>

The classic breadcrumb, in different colors, sizes, and states

html
<o-breadcrumb></o-breadcrumb>

Props

Prop nameDescriptionTypeValuesDefault
ariaLabelAccessibility aria-label to be passed to the nav wrapper elementstring-
From config:
modal: {
  ariaLabel: "Breadcrumb"
}
optionsbreadcrumb items, unnecessary when default slot is usedBreadcrumnOptions-
overrideOverride existing theme classes completelyboolean-
positionPosition of the breadcrumb"centered" | "left" | "right"left, centered, right
From config:
breadcrumb: {
  position: undefined
}
separatorThe separator between breadcrumb itemsstring-
From config:
breadcrumb: {
  separator: "/"
}
sizeSize of the breadcrumbstringsmall, medium, large
From config:
breadcrumb: {
  size: undefined
}
variantColor variant of the breadcrumbstringprimary, info, success, warning, danger, and any other custom color
From config:
breadcrumb: {
  variant: undefined
}

Slots

NameDescriptionBindings
defaultPlace breadcrumb items here

The classic breadrcumb item, in different colors, sizes, and states

html
<o-breadcrumb-item></o-breadcrumb-item>

Props

Prop nameDescriptionTypeValuesDefault
activeWhether item is active or notboolean-false
disabledItem is disabledboolean-false
hiddenDefine whether the item is visible or notboolean-false
iconLeftIcon name to show on the leftstring-
iconPackIcon pack to usestringmdi, fa, fas and any other custom icon pack
From config:
breadcrumb: {
  iconPack: undefined
}
iconRightIcon name to show on the rightstring-
iconSizeIcon sizestringsmall, medium, large
From config:
breadcrumb: {
  iconSize: undefined
}
labelItem label, unnecessary when default slot is usedstring-
overrideOverride existing theme classes completelyboolean-
tagItem tag nameDynamicComponentli, a, router-link, nuxt-link (or other nuxt alias)
From config:
breadcrumb: {
  tag: "a"
}

Slots

NameDescriptionBindings
seperatorItem seperator
defaultOverride the label, default is label prop

Class Inspector

Classes applied to the element:
Want to know how does the Class Inspector work?
Class propDescriptionPropsSuffixes
rootClass
Class of the root element.
sizeClass
Class of the root element with size.
sizesmall
medium
large
variantClass
Class of the root element with variant.
variantprimary
info
warning
danger
positionClass
Class of the breadcrumb with alignment.
positionleft
center
right
listClass
Class of the list element.
itemClass
Class of the item element.
disabledClass
Class of the item element when disabled.
disabled
activeClass
Class of the item element when active.
active
seperatorClass
Class of the item seperator element.
separator
linkClass
Class of the item link element.
iconClass
Class of the item icon element.
iconLeft
iconRight
iconLeftClass
Class of the item left icon element.
iconLeft
iconRightClass
Class of the item right icon element.
iconRight

Sass Variables

Current theme ➜ Oruga

SASS VariableDefault
$breadcrumb-line-height1.25em
$breadcrumb-seperator-colorinherit
$breadcrumb-disabled-opacityh.useVar("control-disabled-opacity")
$breadcrumb-item-spacercalc(0.5 * h.useVar("control-spacer"))
$breadcrumb-item-padding0.3em
$breadcrumb-item-colorh.useVar("font-color")
$breadcrumb-item-font-sizeh.useVar("font-size")
$breadcrumb-item-font-weighth.useVar("font-weight")
$breadcrumb-item-line-heighth.useVar("line-height")
$breadcrumb-item-border-radiush.useVar("border-radius")
$breadcrumb-item-background-colortransparent
$breadcrumb-item-active-colorh.useVar("primary")
$breadcrumb-item-active-background-colortransparent
$breadcrumb-item-hover-colorh.useVar("white")
$breadcrumb-item-hover-background-colorh.useVar("secondary")

See ➜ 📄 SCSS file

Current theme ➜ Bulma

SASS VariableDefault
$breadcrumb-colorsdv.$colors

See ➜ 📄 SCSS file

Current theme ➜ Bootstrap

SASS VariableDefault
$breadcrumb-colorvar(--#{$prefix}primary)

See ➜ 📄 SCSS file

Released under the MIT License.