Search code examples
laravel-backpack

Dropdown Sidebar Menu Items in Laravel Backpack


In the Laravel Backpack docs they show an image that appears to have dropdown menus for the sidebar navigation menu, but I can't find anywhere that says how to use them. Is there a built in way or do I have to write my own styles?

enter image description here


Solution

  • In resources/views/vendor/backpack/base/inc/sidebar.blade.php you can add your own menu-items. Using .treeview and .treeview-menu you can make those items expandable:

    See also the source code of that image.

    <li class="treeview">
      <a href="#"><i class="fa fa-key"></i> <span>Roles & Permissions</span> <i class="fa fa-angle-left pull-right"></i></a>
      <ul class="treeview-menu">
        <li>
          <a href="{{ url(config('backpack.base.route_prefix', 'admin') . '/role') }}"><span>Roles</span></a>
        </li>
        <li>
          <a href="{{ url(config('backpack.base.route_prefix', 'admin') . '/permission') }}"><span>Permissions</span></a>
        </li>
      </ul>
    </li>