mrshanebarron/breadcrumbs
Composer 安装命令:
composer require mrshanebarron/breadcrumbs
包简介
Breadcrumbs navigation component for Laravel - supports Livewire and Vue
README 文档
README
A navigation breadcrumb component for Laravel applications. Shows the current page location within a hierarchy. Works with Livewire and Vue 3.
Installation
composer require mrshanebarron/breadcrumbs
Livewire Usage
Basic Usage
<livewire:sb-breadcrumbs :items="[ ['label' => 'Home', 'href' => '/'], ['label' => 'Products', 'href' => '/products'], ['label' => 'Electronics', 'href' => '/products/electronics'], ['label' => 'Laptops'] ]" />
Different Separators
<!-- Chevron (default) --> <livewire:sb-breadcrumbs :items="$items" separator="chevron" /> <!-- Slash --> <livewire:sb-breadcrumbs :items="$items" separator="slash" /> <!-- Custom character --> <livewire:sb-breadcrumbs :items="$items" separator=">" />
Livewire Props
| Prop | Type | Default | Description |
|---|---|---|---|
items |
array | required | Array of breadcrumb items |
separator |
string | 'chevron' |
Separator style: chevron, slash, or custom |
Item Structure
[
'label' => 'Page Name', // Required: Display text
'href' => '/path', // Optional: Link URL (omit for current page)
'icon' => '<svg>...</svg>' // Optional: Icon HTML
]
Vue 3 Usage
Setup
import { SbBreadcrumbs } from './vendor/sb-breadcrumbs'; app.component('SbBreadcrumbs', SbBreadcrumbs);
Basic Usage
<template> <SbBreadcrumbs :items="breadcrumbs" /> </template> <script setup> const breadcrumbs = [ { label: 'Home', href: '/' }, { label: 'Products', href: '/products' }, { label: 'Current Item' } ]; </script>
With Home Icon
<template> <SbBreadcrumbs :items="breadcrumbs" /> </template> <script setup> const homeIcon = `<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20"> <path d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"/> </svg>`; const breadcrumbs = [ { label: 'Home', href: '/', icon: homeIcon }, { label: 'Dashboard', href: '/dashboard' }, { label: 'Settings' } ]; </script>
Separator Options
<template> <!-- Chevron separator (default) --> <SbBreadcrumbs :items="items" separator="chevron" /> <!-- Slash separator --> <SbBreadcrumbs :items="items" separator="slash" /> <!-- Custom separator --> <SbBreadcrumbs :items="items" separator=">" /> <SbBreadcrumbs :items="items" separator="|" /> </template>
Dynamic Breadcrumbs
<template> <SbBreadcrumbs :items="breadcrumbs" /> </template> <script setup> import { computed } from 'vue'; import { useRoute } from 'vue-router'; const route = useRoute(); const breadcrumbs = computed(() => { const items = [{ label: 'Home', href: '/' }]; const paths = route.path.split('/').filter(Boolean); let currentPath = ''; paths.forEach((segment, index) => { currentPath += `/${segment}`; items.push({ label: segment.charAt(0).toUpperCase() + segment.slice(1), href: index < paths.length - 1 ? currentPath : undefined }); }); return items; }); </script>
Vue Props
| Prop | Type | Default | Description |
|---|---|---|---|
items |
Array | required | Breadcrumb items array |
separator |
String | 'chevron' |
Separator type |
Item Object
| Property | Type | Required | Description |
|---|---|---|---|
label |
String | Yes | Display text |
href |
String | No | Link URL |
icon |
String | No | HTML icon string |
Features
- Multiple Separators: Chevron, slash, or custom
- Icon Support: Add icons to any breadcrumb item
- Auto Current Page: Last item styled as current (no link)
- Accessible: Proper
aria-labelandaria-current
Styling
Uses Tailwind CSS:
- Gray text for links
- Darker text on hover
- Black text for current page
- Smooth color transitions
Accessibility
navelement witharia-label="Breadcrumb"aria-current="page"on last item- Semantic
ollist structure
Requirements
- PHP 8.1+
- Laravel 10, 11, or 12
- Tailwind CSS 3.x
License
MIT License
mrshanebarron/breadcrumbs 适用场景与选型建议
mrshanebarron/breadcrumbs 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 18 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「breadcrumbs」 「navigation」 「laravel」 「vue」 「livewire」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mrshanebarron/breadcrumbs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mrshanebarron/breadcrumbs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mrshanebarron/breadcrumbs 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Breadcrumbs integration for Laravel 6
A block to display a list of links to child pages, or pages in current level
Navigation bundle for Symfony applications
Laravel Menu management
Control pro Nette Framework usnadňující tvorbu menu a drobečkové navigace
Alfabank REST API integration
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-14