PHPackages                             datlechin/filament-menu-builder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. datlechin/filament-menu-builder

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

datlechin/filament-menu-builder
===============================

Create and manage menus and menu items

v1.0.3(2mo ago)14461.5k↓40.8%37[3 PRs](https://github.com/datlechin/filament-menu-builder/pulls)3MITPHPPHP ^8.3CI failing

Since Aug 6Pushed 3w ago3 watchersCompare

[ Source](https://github.com/datlechin/filament-menu-builder)[ Packagist](https://packagist.org/packages/datlechin/filament-menu-builder)[ Docs](https://github.com/datlechin/filament-menu-builder)[ RSS](/packages/datlechin-filament-menu-builder/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (24)Versions (89)Used By (3)

Filament Menu Builder
=====================

[](#filament-menu-builder)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6ad423cb53074527898ea2bafa8c2d9168c6aead593f42ac3e0674974b815718/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6461746c656368696e2f66696c616d656e742d6d656e752d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/datlechin/filament-menu-builder)[![GitHub Tests Action Status](https://camo.githubusercontent.com/81eff1bf6438e9223364fd6aff730ae1cdeb1550aaeb111b119f4e06270b94f3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6461746c656368696e2f66696c616d656e742d6d656e752d6275696c6465722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/datlechin/filament-menu-builder/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/bfdd215b5e54648ec9a1514751abe23c07d7ccb31cb7d15931e08ffe2c1d8cba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6461746c656368696e2f66696c616d656e742d6d656e752d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/datlechin/filament-menu-builder)

[![Filament Menu Builder](https://github.com/datlechin/filament-menu-builder/raw/main/art/menu-builder.jpg)](https://github.com/datlechin/filament-menu-builder/raw/main/art/menu-builder.jpg)

A [Filament](https://filamentphp.com) plugin for building menus with drag-and-drop ordering, nesting, custom links, and dynamic panels.

Requirements
------------

[](#requirements)

- PHP 8.3+
- Filament 5.0+
- Laravel 12+

Upgrading
---------

[](#upgrading)

### From v0.7.x (Filament v3) to v1.x (Filament v5)

[](#from-v07x-filament-v3-to-v1x-filament-v5)

1. Update your `composer.json`:

```
composer require datlechin/filament-menu-builder:^1.0
```

2. Publish and run the new migration to add the `panel`, `icon`, and `classes` columns:

```
php artisan vendor:publish --tag="filament-menu-builder-migrations"
php artisan migrate
```

The upgrade migration checks for existing columns before adding them, so it's safe on fresh installs too.

3. Re-publish the config file if you published it previously:

```
php artisan vendor:publish --tag="filament-menu-builder-config" --force
```

Installation
------------

[](#installation)

Install via Composer:

```
composer require datlechin/filament-menu-builder
```

Publish and run the migrations:

```
php artisan vendor:publish --tag="filament-menu-builder-migrations"
php artisan migrate
```

Optionally, publish the config file:

```
php artisan vendor:publish --tag="filament-menu-builder-config"
```

Or use the install command:

```
php artisan filament-menu-builder:install
```

You will need to set up a Filament [custom theme](https://filamentphp.com/docs/5.x/styling/overview#creating-a-custom-theme)

If you don't yet have a custom theme, run the following command:

```
php artisan make:filament-theme
```

Next, open up the theme.css file for the custom theme and add the following line:

```
@import "../../../../vendor/datlechin/filament-menu-builder/resources/css/index.css";
@source "../../../../vendor/datlechin/filament-menu-builder/resources/**/*.blade.php";
```

Usage
-----

[](#usage)

Register the plugin in your panel provider:

```
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentMenuBuilderPlugin::make(),
        ]);
}
```

### Locations

[](#locations)

Locations define where menus appear in your application:

```
FilamentMenuBuilderPlugin::make()
    ->addLocations([
        'header' => 'Header',
        'footer' => 'Footer',
    ])
```

### Menu Panels

[](#menu-panels)

Panels provide item sources for menus, either from Eloquent models or static lists.

#### Model Panel

[](#model-panel)

Implement `MenuPanelable` on your model:

```
use Datlechin\FilamentMenuBuilder\Contracts\MenuPanelable;

class Page extends Model implements MenuPanelable
{
    public function getMenuPanelTitle(): string
    {
        return $this->title;
    }

    public function getMenuPanelUrl(): string
    {
        return route('pages.show', $this);
    }

    public function getMenuPanelName(): string
    {
        return 'Pages';
    }
}
```

Then register it:

```
use Datlechin\FilamentMenuBuilder\MenuPanel\ModelMenuPanel;

FilamentMenuBuilderPlugin::make()
    ->addMenuPanels([
        ModelMenuPanel::make()
            ->model(Page::class),
    ])
```

#### Static Panel

[](#static-panel)

```
use Datlechin\FilamentMenuBuilder\MenuPanel\StaticMenuPanel;

FilamentMenuBuilderPlugin::make()
    ->addMenuPanels([
        StaticMenuPanel::make()
            ->name('pages')
            ->add('Home', '/')
            ->add('About', '/about')
            ->add('Contact', '/contact'),
    ])
```

`add()` also accepts `target`, `icon`, and `classes`:

```
StaticMenuPanel::make()
    ->name('social')
    ->add('GitHub', 'https://github.com', target: '_blank', icon: 'heroicon-o-code-bracket')
    ->add('Twitter', 'https://twitter.com', target: '_blank', classes: 'text-blue-500')
```

### Custom Link &amp; Custom Text Panels

[](#custom-link--custom-text-panels)

The custom link panel is shown by default. The custom text panel (for non-link items like headings) is opt-in:

```
FilamentMenuBuilderPlugin::make()
    ->showCustomLinkPanel(true)
    ->showCustomTextPanel(true)
```

### Custom Fields

[](#custom-fields)

Add extra fields to the menu or menu item forms:

```
use Filament\Forms\Components\TextInput;

FilamentMenuBuilderPlugin::make()
    ->addMenuFields([
        TextInput::make('description'),
    ])
    ->addMenuItemFields([
        TextInput::make('badge'),
    ])
```

Singular methods work too:

```
FilamentMenuBuilderPlugin::make()
    ->addMenuField(TextInput::make('description'))
    ->addMenuItemField(TextInput::make('badge'))
```

Multiple calls are merged, so fields registered from different service providers won't overwrite each other.

### Customizing Navigation

[](#customizing-navigation)

```
FilamentMenuBuilderPlugin::make()
    ->navigationLabel('Menus')
    ->navigationGroup('Content')
    ->navigationIcon('heroicon-o-bars-3')
    ->navigationSort(3)
    ->navigationCountBadge(true)
```

### Indent / Unindent

[](#indent--unindent)

Nesting via indent/unindent actions is enabled by default:

```
FilamentMenuBuilderPlugin::make()
    ->enableIndentActions(true)
```

### Translatable Menus

[](#translatable-menus)

Built-in multilingual support with no extra packages required. Translatable fields are stored as JSON with locale tabs in the form UI.

#### Setup

[](#setup)

1. Enable translatable with your locales:

```
FilamentMenuBuilderPlugin::make()
    ->translatable(['en', 'nl', 'vi'])
```

2. Publish and run the migration to convert columns from `string` to `json`:

```
php artisan vendor:publish --tag="filament-menu-builder-translatable-migrations"
php artisan migrate
```

Existing string data is wrapped in the default locale (`en`). Edit `$defaultLocale` in the published migration to change this.

#### Configuring Translatable Fields

[](#configuring-translatable-fields)

Only `MenuItem.title` is translatable by default:

```
FilamentMenuBuilderPlugin::make()
    ->translatable(['en', 'nl', 'vi'])
    ->translatableMenuItemFields(['title'])  // default
    ->translatableMenuFields(['name'])       // opt-in: make Menu name translatable too
```

#### Rendering Translated Titles

[](#rendering-translated-titles)

Use `resolveLocale()` in Blade to display titles in the current locale:

```
@foreach($menu->menuItems as $item)

        {{ $item->resolveLocale($item->title) }}

@endforeach
```

`resolveLocale()` returns the translation for `app()->getLocale()`, falls back to the first available translation, or returns the raw string for non-translatable setups.

#### Spatie Translatable Compatibility

[](#spatie-translatable-compatibility)

The JSON format is compatible with [Spatie Laravel Translatable](https://github.com/spatie/laravel-translatable). If you add `HasTranslations` to a custom model, the plugin detects it and defers to Spatie's mutators.

```
use Spatie\Translatable\HasTranslations;

class CustomMenuItem extends MenuItem
{
    use HasTranslations;

    public array $translatable = ['title'];
}
```

### Custom Models

[](#custom-models)

Replace the default models with your own:

```
FilamentMenuBuilderPlugin::make()
    ->usingMenuModel(CustomMenu::class)
    ->usingMenuItemModel(CustomMenuItem::class)
    ->usingMenuLocationModel(CustomMenuLocation::class)
```

### Rendering Menus

[](#rendering-menus)

Retrieve a menu by location. Results are cached and automatically busted on changes:

```
use Datlechin\FilamentMenuBuilder\Models\Menu;

$menu = Menu::location('header');
```

Render menu items:

```
@if($menu)

            @foreach($menu->menuItems as $item)

                    @if($item->url)
                        rel) rel="{{ $item->rel }}" @endif>
                            {{ $item->resolveLocale($item->title) }}

                    @else
                        {{ $item->resolveLocale($item->title) }}
                    @endif

                    @if($item->children->isNotEmpty())

                            @foreach($item->children as $child)

                                    {{ $child->resolveLocale($child->title) }}

                            @endforeach

                    @endif

            @endforeach

@endif
```

#### Active State Detection

[](#active-state-detection)

Check if a menu item matches the current URL:

```
$item->isActive();                 // exact URL match
$item->isActiveOrHasActiveChild(); // matches self or any descendant
```

### MenuItem Properties

[](#menuitem-properties)

PropertyTypeDescription`title`string|arrayThe display title (array when translatable)`url`?stringThe URL (null for text-only items)`target`stringLink target (`_self`, `_blank`, etc.)`icon`?stringIcon identifier (e.g. `heroicon-o-home`)`classes`?stringCSS classes for the item`rel`?stringLink rel attribute (e.g. `nofollow noopener`)`type`stringPanel name / source type (accessor)`children`CollectionNested child itemsTesting
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

See [CHANGELOG](CHANGELOG.md) for recent changes.

License
-------

[](#license)

MIT License. See [LICENSE.md](LICENSE.md).

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance92

Actively maintained with recent releases

Popularity49

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 54.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~28 days

Recently: every ~83 days

Total

23

Last Release

66d ago

Major Versions

v0.7.0 → v1.0.02026-03-07

PHP version history (2 changes)v0.1.0PHP ^8.1

v1.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5dca3124d040fb5f1e59100485f3a23e42e4e4b1c6d89c5d4cd3e79d95f574e?d=identicon)[Ngô Quốc Đạt](/maintainers/Ng%C3%B4%20Qu%E1%BB%91c%20%C4%90%E1%BA%A1t)

---

Top Contributors

[![datlechin](https://avatars.githubusercontent.com/u/56961917?v=4)](https://github.com/datlechin "datlechin (179 commits)")[![depfu[bot]](https://avatars.githubusercontent.com/in/715?v=4)](https://github.com/depfu[bot] "depfu[bot] (62 commits)")[![Log1x](https://avatars.githubusercontent.com/u/5745907?v=4)](https://github.com/Log1x "Log1x (58 commits)")[![Senexis](https://avatars.githubusercontent.com/u/6360733?v=4)](https://github.com/Senexis "Senexis (10 commits)")[![iRaziul](https://avatars.githubusercontent.com/u/51883557?v=4)](https://github.com/iRaziul "iRaziul (5 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![bdsumon4u](https://avatars.githubusercontent.com/u/75123992?v=4)](https://github.com/bdsumon4u "bdsumon4u (2 commits)")[![mckenziearts](https://avatars.githubusercontent.com/u/14105989?v=4)](https://github.com/mckenziearts "mckenziearts (2 commits)")[![StevyMarlino](https://avatars.githubusercontent.com/u/25743606?v=4)](https://github.com/StevyMarlino "StevyMarlino (1 commits)")[![Cannonb4ll](https://avatars.githubusercontent.com/u/3110750?v=4)](https://github.com/Cannonb4ll "Cannonb4ll (1 commits)")[![ImgBotApp](https://avatars.githubusercontent.com/u/31427850?v=4)](https://github.com/ImgBotApp "ImgBotApp (1 commits)")[![mmoollllee](https://avatars.githubusercontent.com/u/26859300?v=4)](https://github.com/mmoollllee "mmoollllee (1 commits)")[![AndreyTodorov](https://avatars.githubusercontent.com/u/53942571?v=4)](https://github.com/AndreyTodorov "AndreyTodorov (1 commits)")

---

Tags

filamentfilament-pluginfilamentphpmenumenu-builderlaraveldatlechinfilament-menu-builder

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/datlechin-filament-menu-builder/health.svg)

```
[![Health](https://phpackages.com/badges/datlechin-filament-menu-builder/health.svg)](https://phpackages.com/packages/datlechin-filament-menu-builder)
```

###  Alternatives

[stephenjude/filament-feature-flags

Filament implementation of feature flags and segmentation with Laravel Pennant.

122177.8k1](/packages/stephenjude-filament-feature-flags)[ysfkaya/filament-phone-input

A phone input component for Laravel Filament

3161.3M25](/packages/ysfkaya-filament-phone-input)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[marcelweidum/filament-expiration-notice

Customize the livewire expiration notice

94135.4k5](/packages/marcelweidum-filament-expiration-notice)[stephenjude/filament-jetstream

A Laravel starter kit built with Filament inspired by Jetstream.

17760.2k3](/packages/stephenjude-filament-jetstream)[stephenjude/filament-debugger

About

104162.2k2](/packages/stephenjude-filament-debugger)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
