pos-lifestyle/laravel-nova-collapsible-sidebar

A Laravel Nova collapsible sidebar.
3,640 5
Install
composer require pos-lifestyle/laravel-nova-collapsible-sidebar
Latest Version:1.0.0
PHP:^7.1
License:MIT
Last Updated:Nov 2, 2021
Links: GitHub  ·  Packagist
Maintainer: pos-lifestyle

Laravel Nova Collapsible Sidebar

Packagist Packagist Version

About

This is a collapsible sidebar for Laravel Nova 2.

Installation

To install the sidebar run the following command in your Laravel Nova project:

composer require pos-lifestyle/laravel-nova-collapsible-sidebar

Usage

Copy the Laravel Nova layout template vendor/laravel/nova/resources/views/layout.blade.php to resources/views/vendor/nova/layout.blade.php.

mkdir -p resources/views/vendor/nova
cp -r vendor/laravel/nova/resources/views/layout.blade.php resources/views/vendor/nova/layout.blade.php

In resources/views/vendor/nova/layout.blade.php you will find the sidebar which looks like this:

<!-- Sidebar -->
<div class="min-h-screen flex-none pt-header min-h-screen w-sidebar bg-grad-sidebar px-6">
    <a href="https://github.com/pos-lifestyle/laravel-nova-collapsible-sidebar/blob/HEAD/{{ \Laravel\Nova\Nova::path() }}">
        <div class="absolute pin-t pin-l pin-r bg-logo flex items-center w-sidebar h-header px-6 text-white">
           @include('nova::partials.logo')
        </div>
    </a>

    @foreach (\Laravel\Nova\Nova::availableTools(request()) as $tool)
        {!! $tool->renderNavigation() !!}
    @endforeach
</div>

Replace the ordinary div tag by collapsible-sidebar:

<collapsible-sidebar class="min-h-screen flex-none pt-header min-h-screen w-sidebar bg-grad-sidebar px-6">
    ...
</collapsible-sidebar>

Now you can toggle the sidebar by clicking the icon on the top right of the sidebar. The sidebar automatically expands when you move the mouse pointer over the sidebar.

Configuration

To save the state, add persist to the collapsible-sidebar tag.

<collapsible-sidebar class="..." persist>
    ...
</collapsible-sidebar>

To show the trigger only when you move the mouse pointer over the sidebar, add shy-trigger to the collapsible-sidebar tag.

<collapsible-sidebar class="..." shy-trigger>
    ...
</collapsible-sidebar>

Screenshots

Related Packages

digital-creative/collapsible-resource-manager

A custom sidebar menu with collapsible groups

927,002 199
emuniq/filament-collapsible-subnav

A Filament v3, v4 & v5 plugin for collapsible sub-navigation sidebar.

15,001 9
arcanesoft/sidebar

Sidebar generator for ARCANESOFT's admin dashboard

2,139 1
jeffersongoncalves/filament-refresh-sidebar

Automatically refresh the Filament sidebar navigation when certain events occur,...

2,543 11
skylence/filament-mega-menu

A mega menu sidebar plugin for Filament 5

4,308 0