Breadcrumb

new

The path to the current page, as links separated by chevrons.

Demo

Installation

Usage

<script setup lang="ts">
import {
  Breadcrumb,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
  BreadcrumbSeparator,
} from '@/components/ui/breadcrumb'
</script>

<template>
  <Breadcrumb>
    <BreadcrumbList>
      <BreadcrumbItem>
        <BreadcrumbLink href="/">Home</BreadcrumbLink>
      </BreadcrumbItem>
      <BreadcrumbSeparator />
      <BreadcrumbItem>
        <BreadcrumbLink href="/docs/components">Components</BreadcrumbLink>
      </BreadcrumbItem>
      <BreadcrumbSeparator />
      <BreadcrumbItem>
        <BreadcrumbPage>Breadcrumb</BreadcrumbPage>
      </BreadcrumbItem>
    </BreadcrumbList>
  </Breadcrumb>
</template>

Examples

Custom separator

Put your own icon in BreadcrumbSeparator's slot.

With a custom separator

The demo above opens a menu from the ellipsis. The button around it carries the aria-label, since the ellipsis itself is hidden from screen readers.

Collapsed

BreadcrumbEllipsis stands in for the middle of a long trail.

Collapsed breadcrumb

BreadcrumbLink renders an a. Use as-child to render your router's link instead, such as NuxtLink or RouterLink.

With your own links

API Reference

class is accepted on every part and merged over its classes with tailwind-merge.

Data attributes

data-slotAttributesDescription
breadcrumb—The nav, labelled "breadcrumb".
breadcrumb-list—The ordered list.
breadcrumb-item—One step of the trail.
breadcrumb-link—A link to an earlier page.
breadcrumb-page—The current page, with aria-current="page".
breadcrumb-separator—The icon between two items, hidden from screen readers.
breadcrumb-ellipsis—The icon in place of collapsed items.

Changelog

  1. registry 0.22.0

    cc8c5ec — A gap-* class on BreadcrumbList applies at every width; the list's own gap, wider from the sm breakpoint up, now comes through --breadcrumb-gap, so its sm: rule no longer outranks the class.

    986a0db — The default BreadcrumbSeparator chevron points the other way in right-to-left text.

  2. registry 0.10.0

    0a9aa94 — DropdownMenu and ContextMenu are removed: Menu covers both, opening on click from the element it sits in or from a MenuTrigger, and with context-menu on right-click and long-press. It has the same parts (MenuItem, MenuCheckboxItem, MenuRadioGroup, MenuRadioItem, MenuLabel, MenuSeparator, MenuShortcut, MenuGroup, MenuSub, MenuSubTrigger, MenuSubContent), sizes and styles, so moving over means renaming the parts and replacing DropdownMenuTrigger/ContextMenuTrigger and the content part with a Menu inside the element that opens it; align="end" becomes anchor="bottom end" self="top end". Copies already in a project keep working. The Breadcrumb, ButtonGroup, DrawerMenu and overlay examples use Menu.

  3. registry 0.3.0

    a014941 — Add Breadcrumb, from shadcn-vue.