Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Menu Laravel Package

spatie/menu

Fluent, extensible menu builder for Laravel. Compose navigation with a clean API, render as HTML, and customize output via presenters and macros. Supports active state handling, links, submenus, and easy integration with Blade and your app’s routing.

View on GitHub
Deep Wiki
Context7

title: Appending and Prepending Html weight: 3

You can append and prepend html outside of the ul tag with similarly named functions. This is useful for submenu titles or separators.

Menu::new()
    ->prepend('<h2>Title</h2>')
    ->add(Link::to('/title/subpage', 'Subpage'))
    ->append('<hr>');
<h2>Title</h2>
<ul>
    <li>
        <a href="/title/subpage">Subpage</a>
    </li>
</ul>
<hr>

If you only want to add html in certain conditions, you can use appendIf and prependIf.

$displayTitles = false;
$displayRulers = true;

Menu::new()
    ->prependIf($displayTitles, '<h2>Title</h2>')
    ->add(Link::to('/title/subpage', 'Subpage'))
    ->appendIf($displayRulers, '<hr>');

You can also wrap the menu in an element.

Menu::new()->wrap('div', ['class' => 'nav']);
<div class="nav">
  <ul></ul>
</div>
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core