Breadcrumb
Navigation component that helps users keep track of their location within a website or application.
Basic Usage
Render a breadcrumb trail by passing an array of items to the breadcrumbs prop.
<template>
<HLBreadcrumb :breadcrumbs="breadcrumbs" id="example-breadcrumb-basic"> </HLBreadcrumb>
</template>
<script setup>
import { HLBreadcrumb } from '@platform-ui/highrise'
const breadcrumbs = [
{
label: 'Home',
href: 'https://google.com',
},
{
label: 'Electronics',
href: 'https://google.com',
},
{
label: 'Mobiles',
href: 'https://google.com',
},
]
</script>Without Home Icon
Set the home prop to false to hide the leading home icon.
<template>
<HLBreadcrumb :breadcrumbs="breadcrumbs" id="example-breadcrumb-basic" :home="false"> </HLBreadcrumb>
</template>
<script setup>
import { HLBreadcrumb } from '@platform-ui/highrise'
const breadcrumbs = [
{
label: 'Home',
href: 'https://google.com',
},
{
label: 'Electronics',
href: 'https://google.com',
},
{
label: 'Mobiles',
href: 'https://google.com',
},
]
</script>Custom Separator
Pass the separator prop to replace the default slash between items.
<template>
<HLBreadcrumb :breadcrumbs="breadcrumbs" id="example-breadcrumb-basic" separator=">"> </HLBreadcrumb>
</template>
<script setup>
import { HLBreadcrumb } from '@platform-ui/highrise'
const breadcrumbs = [
{
label: 'Home',
href: 'https://google.com',
},
{
label: 'Electronics',
href: 'https://google.com',
},
{
label: 'Mobiles',
href: 'https://google.com',
},
]
</script>Handling Navigation
Use onClick handlers for custom navigation logic instead of href when you need programmatic control over navigation. The handler receives the item's label string as its only argument.
Each item's navigation behavior follows these rules:
onClicktakes precedence overhref. When an item definesonClick, itshrefis ignored — the handler runs and default browser navigation is prevented. Provide eitheronClick(for programmatic navigation) orhref(for standard link navigation), not both.clickable: falsemakes an item inert. It renders as plain, non-interactive text — no link is produced and anyonClickis skipped.- The current (last) item is never a link. The final crumb is treated as the current page: it is not linked and does not fire
onClick.
The home icon follows the same pattern through its own pair of props: onHomeClick for programmatic navigation, homeHref for a standard link. Setting onHomeClick drops the href and prevents default navigation, so use one or the other. The handler always receives the literal string 'Home' rather than a breadcrumb label.
<template>
<HLBreadcrumb :breadcrumbs="clickableBreadcrumbs" id="example-breadcrumb-onclick" :onHomeClick="handleHomeClick"> </HLBreadcrumb>
</template>
<script setup>
import { HLBreadcrumb } from '@platform-ui/highrise'
const handleHomeClick = () => {
console.log('Navigate to Home')
// Your custom navigation logic here
}
const clickableBreadcrumbs = [
{
label: 'Dashboard',
onClick: label => console.log('Navigate to Dashboard:', label),
},
{
label: 'Users',
onClick: label => console.log('Navigate to Users:', label),
},
{
label: 'Profile', // Current page - no onClick
},
]
</script>With Overflow
Overflow will comes into play when the breadcrumb items are more than or equal to 4.
<template>
<HLBreadcrumb :breadcrumbs="longBreadcrumbs" home id="example-breadcrumb-overflow"> </HLBreadcrumb>
</template>
<script setup>
import { HLBreadcrumb } from '@platform-ui/highrise'
import { longBreadcrumbs } from './breadcrumbs'
</script>export const longBreadcrumbs = [
{
label: 'Breadcrumb1',
href: 'https://google.com',
},
{
label: 'Breadcrumb2',
href: 'https://google.com',
},
{
label: 'Breadcrumb3',
href: 'https://google.com',
},
{
label: 'Breadcrumb4',
href: 'https://google.com',
},
{
label: 'Breadcrumb5',
href: 'https://google.com',
},
{
label: 'Breadcrumb6',
href: 'https://google.com',
},
{
label: 'Breadcrumb7',
},
]Accessibility
- Set
aria-current="page"on the final crumb and avoid linking it to prevent redundant focus stops. - Use
aria-labelon truncated crumbs so the full destination is announced.
Imports
import { HLBreadcrumb } from '@platform-ui/highrise'Props
HLBreadcrumb Props
| Name | Type | Default | Description |
|---|---|---|---|
| id * | string | undefined | undefined | Unique identifier for the breadcrumb |
| separator | string | / | Custom separator between breadcrumb items |
| size | 'sm' | 'md' | 'lg' | lg | Size of the breadcrumb |
| home | boolean | true | Whether to show home icon |
| homeHref | string | / | URL for home icon navigation (used when no onHomeClick) |
| onHomeClick | (label: string) => void | undefined | Click handler for the home icon, always called with 'Home'. Takes precedence over homeHref |
| breadcrumbs | BreadcrumbItem[] | null | null | Array of breadcrumb items with label and href |
Breadcrumb Item Type
interface BreadcrumbItem {
label: string
href?: string
clickable?: boolean
onClick?: (label: string) => void
}| Name | Type | Default | Description |
|---|---|---|---|
| label * | string | - | Text shown for the crumb |
| href | string | undefined | URL for standard link navigation. Ignored when onClick is set, when clickable is false, or on the current (last) item |
| clickable | boolean | true | Set to false to render the item as plain, non-interactive text — no link is produced and onClick is skipped |
| onClick | (label: string) => void | undefined | Handler for programmatic navigation, called with the item's label. Takes precedence over href |