Skip to content

Breadcrumb

Show users exactly where they are within a page hierarchy and give them a quick path back to any parent level. Breadcrumbs are especially valuable in applications with deep navigation structures, where the sidebar alone does not make the current location obvious.

ts
import { CoarBreadcrumb, CoarBreadcrumbItem } from '@cocoar/vue-ui';

Basic Usage

Wrap each level in a CoarBreadcrumbItem. Parent levels are rendered as links; the last item is marked active to indicate the current page. Separators between items are handled automatically.

vue
<template>
  <CoarBreadcrumb>
    <CoarBreadcrumbItem><a href="javascript:void(0)">Home</a></CoarBreadcrumbItem>
    <CoarBreadcrumbItem><a href="javascript:void(0)">Users</a></CoarBreadcrumbItem>
    <CoarBreadcrumbItem :active="true">John Doe</CoarBreadcrumbItem>
  </CoarBreadcrumb>
</template>

<script setup lang="ts">
import { CoarBreadcrumb, CoarBreadcrumbItem } from '@cocoar/vue-ui';
</script>

Deep Hierarchy

Breadcrumbs scale naturally for deeply nested content. Even a five-level trail remains compact and readable, giving users confidence about their location.

vue
<template>
  <CoarBreadcrumb>
    <CoarBreadcrumbItem><a href="javascript:void(0)">Home</a></CoarBreadcrumbItem>
    <CoarBreadcrumbItem><a href="javascript:void(0)">Products</a></CoarBreadcrumbItem>
    <CoarBreadcrumbItem><a href="javascript:void(0)">Electronics</a></CoarBreadcrumbItem>
    <CoarBreadcrumbItem><a href="javascript:void(0)">Laptops</a></CoarBreadcrumbItem>
    <CoarBreadcrumbItem :active="true">MacBook Pro 16"</CoarBreadcrumbItem>
  </CoarBreadcrumb>
</template>

<script setup lang="ts">
import { CoarBreadcrumb, CoarBreadcrumbItem } from '@cocoar/vue-ui';
</script>

App Navigation

Here are several breadcrumb paths you might encounter in a real application -- from a simple two-level dashboard path to a four-level project issue drill-down.

vue
<template>
  <div style="display: flex; flex-direction: column; gap: 16px;">
    <CoarBreadcrumb>
      <CoarBreadcrumbItem><a href="javascript:void(0)">Dashboard</a></CoarBreadcrumbItem>
      <CoarBreadcrumbItem :active="true">Overview</CoarBreadcrumbItem>
    </CoarBreadcrumb>
    <CoarBreadcrumb>
      <CoarBreadcrumbItem><a href="javascript:void(0)">Settings</a></CoarBreadcrumbItem>
      <CoarBreadcrumbItem><a href="javascript:void(0)">Account</a></CoarBreadcrumbItem>
      <CoarBreadcrumbItem :active="true">Security</CoarBreadcrumbItem>
    </CoarBreadcrumb>
    <CoarBreadcrumb>
      <CoarBreadcrumbItem><a href="javascript:void(0)">Projects</a></CoarBreadcrumbItem>
      <CoarBreadcrumbItem><a href="javascript:void(0)">Alpha</a></CoarBreadcrumbItem>
      <CoarBreadcrumbItem><a href="javascript:void(0)">Issues</a></CoarBreadcrumbItem>
      <CoarBreadcrumbItem :active="true">#142 Fix date picker</CoarBreadcrumbItem>
    </CoarBreadcrumb>
  </div>
</template>

<script setup lang="ts">
import { CoarBreadcrumb, CoarBreadcrumbItem } from '@cocoar/vue-ui';
</script>

Accessibility

Keyboard Navigation

KeyAction
TabMove between breadcrumb links
EnterActivate the focused link
Shift + TabMove focus backward

API

CoarBreadcrumb Props

PropTypeDefaultDescription
separatorstring'/'Separator character between items
ariaLabelstring'Breadcrumb'Accessible label for the nav landmark

CoarBreadcrumbItem Props

PropTypeDefaultDescription
activebooleanfalseMark as the current/active page (not a link)

CoarBreadcrumbItem Slots

SlotDescription
defaultItem content -- typically an anchor tag for links, or plain text for the active item

Released under the Apache-2.0 License.