Kryptonit3's avatar

JetStream - Adding Dropdown links to main Navigation

What is the proper way to add dropdown links to the navigation beside "Dashboard"?

I know it is in the /resources/views/navigation-dropdown.blade.php.

Here is my attempt

            <div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
                <x-jet-nav-link href="{{ route('dashboard') }}" :active="request()->routeIs('dashboard')">
                    {{ __('Dashboard') }}
                </x-jet-nav-link>
            </div>
            <div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
                <x-jet-dropdown align="right" width="48">
                    <x-slot name="trigger">

                        <button class="flex items-center text-sm font-medium text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition duration-150 ease-in-out">
                            <div>Admin</div>

                            <div class="ml-1">
                                <svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
                                    <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
                                </svg>
                            </div>
                        </button>

                    </x-slot>

                    <x-slot name="content">

                        <!-- User Management -->
                        <div class="block px-4 py-2 text-xs text-gray-400">
                            {{ __('Users') }}
                        </div>

                        <x-jet-dropdown-link href="{{ route('admin.users.index') }}">
                            {{ __('All Users') }}
                        </x-jet-dropdown-link>

                    </x-slot>

                </x-jet-dropdown>
            </div>

This is the result

image

image

0 likes
7 replies
lhsnet's avatar

I have the same problem. Maybe you got a solution?

NikhilJain's avatar

oops my reply did not have the HTML I added

intead:

<div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">

use:

<div class="hidden sm:flex sm:items-center sm:ml-6">

3 likes
aesmm18's avatar

Hi! How i will make this dropdown active ??

K8_'s avatar

My dropdown menu does not work .Any suggestions?

whiteWolf's avatar
            <div class="hidden sm:flex sm:items-center sm:ms-6">
                <!-- Dropdown -->
                <div class="ms-3 relative">
                    <x-dropdown align="right" width="60">
                        <x-slot name="trigger">
                            <span class="inline-flex rounded-md">
                                <button type="button"
                                    class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none focus:bg-gray-50 active:bg-gray-50 transition ease-in-out duration-150">
                                    {{ __('Extra features') }}
                                    <svg class="ms-2 -me-0.5 h-4 w-4" xmlns="http://www.w3.org/2000/svg"
                                        fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                                        <path stroke-linecap="round" stroke-linejoin="round"
                                            d="M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" />
                                    </svg>
                                </button>
                            </span>
                        </x-slot>

                        <x-slot name="content">
                            <div class="w-60">
                                <!-- Extra Tables -->
                                <div class="block px-4 py-2 text-xs text-gray-400">
                                    {{ __('Extra Tables') }}
                                </div>

                                <!-- User Roles -->
                                <x-dropdown-link href="{{ route('update-user-role') }}">
                                    {{ __('User Roles') }}
                                </x-dropdown-link>
                                <!-- User Roles -->
                                <x-dropdown-link href="#">
                                    {{ __('Project Status') }}
                                </x-dropdown-link>
                            </div>
                        </x-slot>
                    </x-dropdown>
                </div>
            </div>
whiteWolf's avatar

I used this method to add dropdown for the jetstream navigation menu

Please or to participate in this conversation.