Menu & Sidebar

The sidebar (and optional top-nav) is driven entirely by the menu array in config/adminlte.php. Each element is a single menu item. Items pass through a filter pipeline that resolves URLs, computes the active state, and hides items the current user is not authorized to see.

A real menu example

'menu' => [
    ['header' => 'MAIN'],

    [
        'text' => 'Dashboard',
        'route' => 'dashboard',
        'icon' => 'bi bi-speedometer',
    ],

    // External link, opens in a new tab
    [
        'text' => 'Users',
        'url' => 'admin/users',
        'icon' => 'bi bi-people',
        'can' => 'view-users',
        'label' => 5,
        'label_color' => 'danger',
    ],

    ['header' => 'CONTENT'],

    // Treeview (collapsible submenu, nestable to any depth)
    [
        'text' => 'Posts',
        'icon' => 'bi bi-file-post',
        'submenu' => [
            ['text' => 'All posts', 'route' => 'posts.index', 'icon' => 'bi bi-circle'],
            ['text' => 'New post', 'route' => ['posts.edit', ['id' => 1]], 'icon' => 'bi bi-circle'],
        ],
    ],
],

Item keys

KeyPurpose
headerRenders a non-clickable section label (<li class="nav-header">) instead of a link.
textThe visible link label (required for links).
routeNamed route. String, or [name, params] array — resolved with Laravel's route().
urlRaw URL (relative or absolute). External URLs (//, mailto:, tel:) are kept verbatim; others pass through url().
iconBootstrap Icons class (e.g. bi bi-speedometer). Defaults to bi bi-circle if omitted.
icon_colorAdds text-{color} to the icon.
label / label_colorBadge value after the text, with text-bg-{color} (defaults to primary).
targetAnchor target (e.g. _blank); adds rel="noopener" automatically.
can / can_paramsGate ability (string or array) required to display the item; can_params is the model/argument.
activeURL pattern(s) that mark the item active (string or array of Request::is() patterns).
submenuArray of child items, rendered as a collapsible treeview (nestable to any depth).

The filter pipeline

Filters are listed in config('adminlte.filters') and run in array order. Each implements ColorlibHQ\AdminLte\Menu\Filters\FilterInterface with transform(array $item): ?array — returning null drops the item.

OrderFilterEffect
1GateFilterRemoves items the current user is not authorized to see (can).
2HrefFilterResolves the final href from route / url.
3ActiveFilterMarks the active item / treeview branch.
4SearchFilterNormalizes navbar-search items (method, placeholder, url).

Active-state behavior

  • If active is a boolean it is respected as-is.
  • If active is a pattern (or list), the item is active when the request matches via Request::is().
  • With no active pattern, one is auto-derived from url: a URL admin/users matches both admin/users and admin/users/*. '/' matches only the root; '#' never matches.
  • A treeview parent becomes active (and opens, menu-open) when any descendant is active.

Scoped menus & runtime additions

Resolve the menu builder singleton via app('adminlte'). Place items in the topbar with topnav / topnav_right, or add items at runtime from a service provider's boot():

// Place an item in the right side of the topbar instead of the sidebar
['text' => 'Help', 'url' => 'help', 'icon' => 'bi bi-question-circle', 'topnav_right' => true];

// Insert after an item matching key/text/header
app('adminlte')->addAfter('Dashboard',
    ['header' => 'REPORTS'],
    ['text' => 'Sales', 'route' => 'reports.sales', 'icon' => 'bi bi-graph-up'],
);

// Or append to the end
app('adminlte')->add(
    ['text' => 'Status', 'url' => 'status', 'icon' => 'bi bi-activity'],
);

Give items an explicit 'key' => 'dashboard' when you want a stable anchor for addAfter() that survives text changes and translation. Runtime additions persist for the rest of the request and reset on the next one.


AdminLTE 4 · Laravel port Edit on GitHub