WireUi Breadcrumbs
🔥
Breadcrumbs
This package provides a beautiful breadcrumbs component, with a simple and easy way to define your breadcrumbs.
You can define it in routes or full page livewire components.
📚
Get Started
Prerequisites:
Optional
If you want to use the default breadcrumbs component, you need to install these packages.
Install
composer require wireui/breadcrumbs
Using Tailwind?
Add the breadcrumbs path to the content of your Tailwind config file.
/** @type {import('tailwindcss').Config} */
module.exports = {
...
content: [
'./vendor/wireui/breadcrumbs/src/**/*.php',
],
...
}
How to use it?
You can define it on routes by calling the breadcrumbs method in the route or the livewire component.
This method accepts a callable function that returns the Trail instance.
Dependency Injection
The callable function can resolve all dependency injections, like classes, services, models, etc.
use Illuminate\Support\Facades\Route;
use WireUi\Breadcrumbs\Trail;
Route::get('/users/{user}', Index::class)
->breadcrumbs(function (
Trail $trail,
User $user,
Request $request,
Foo $foo
) {
return $trail
->push('Users', route('users'))
->push('View');
})
->name('users.view');
Routes
You can define your breadcrumbs in the routes
use Illuminate\Support\Facades\Route;
use WireUi\Breadcrumbs\Trail;
Route::get('/users/create', Index::class)
->breadcrumbs(function (Trail $trail) {
return $trail
->push('Users', route('users'))
->push('Create');
})
->name('users.create');
Livewire Components
You can define your breadcrumbs in the livewire components.
The breadcrumbs in the livewire components is reactive
<?php
namespace App\Http\Livewire;
use Livewire\Component;
use WireUi\Breadcrumbs\Trail;
class Index extends Component
{
...
public function breadcrumbs(Trail $trail): Trail
{
return $trail
->push('Users', route('users'))
->push('Create 1');
}
...
}
Rendering
Just add the breadcrumbs component in your layout
<x-breadcrumbs />
Publish (Optional)
php artisan vendor:publish --tag="wireui.breadcrumbs.config"
php artisan vendor:publish --tag="wireui.breadcrumbs.views"
📣
Follow the author
Stay informed about WireUI, follow @ph7jack on Twitter.
You will you see all the latest news about features, ideas, discussions, and more...
💡
Philosophy
WireUI Breadcrumbs is always FREE to anyone who would like to use it. You can use the Breadcrumbs in your laravel project.
This project is created PH7-Jack, and it is maintained by the author with the help of the community.
All contributions are welcome!