--- title: "navbar-04" description: "Navbar with a mega menu laid out as a two-column grid of icon, title, and description items. Mobile menu uses an expandable sheet." category: "Navbar" --- # navbar-04 Navbar with a mega menu laid out as a two-column grid of icon, title, and description items. Mobile menu uses an expandable sheet. ## Installation ```bash php artisan ui:add-block navbar-04 ``` ## Dependencies - composer: `gehrisandro/tailwind-merge-laravel` - component: [button](https://laralcn-ui.abdulkadersafi.com/components/button.md) — the CLI installs it for you. - component: [collapsible](https://laralcn-ui.abdulkadersafi.com/components/collapsible.md) — the CLI installs it for you. - component: [sheet](https://laralcn-ui.abdulkadersafi.com/components/sheet.md) — the CLI installs it for you. ## Source `resources/views/components/ui/blocks/navbar-04.blade.php` ```blade {{-- Every piece of content is a prop, so you can drive this navbar from a CMS. A link is either a plain string or ['label' => ..., 'href' => ...]. A mega item is ['label' =>, 'description' =>, 'href' =>, 'icon' => '']; the grid is two columns, so an even count looks best. An action is ['label' =>, 'href' =>, 'variant' =>]; give it an href and it renders as a link, leave href out and it stays a plain button. --}} @props([ 'brand' => 'LaralCN', 'brandHref' => '#', 'megaLabel' => 'Features', 'megaItems' => null, 'links' => ['Pricing', 'Docs'], 'actions' => [ ['label' => 'Sign in', 'href' => null, 'variant' => 'ghost'], ['label' => 'Get Started', 'href' => null, 'variant' => 'default'], ], ]) @php $link = static fn($item): array => is_array($item) ? $item + ['href' => '#'] : ['label' => $item, 'href' => '#']; $icon = static fn( string $paths, ): string => ''; $items = $megaItems ?? [ [ 'label' => 'Page One', 'description' => 'Short description of the page goes here.', 'icon' => $icon( '', ), ], [ 'label' => 'Page Two', 'description' => 'Short description of the page goes here.', 'icon' => $icon( '', ), ], [ 'label' => 'Page Three', 'description' => 'Short description of the page goes here.', 'icon' => $icon( '', ), ], [ 'label' => 'Page Four', 'description' => 'Short description of the page goes here.', 'icon' => $icon( '', ), ], [ 'label' => 'Page Five', 'description' => 'Short description of the page goes here.', 'icon' => $icon( '', ), ], [ 'label' => 'Page Six', 'description' => 'Short description of the page goes here.', 'icon' => $icon( '', ), ], ]; @endphp
merge(['class' => 'sticky top-0 z-40 w-full border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60']) }}>
{{-- Logo --}} {{ $logo ?? '' }} @empty($logo) @endempty {{ $brand }} {{-- Desktop navigation --}} {{-- Desktop actions --}} {{-- Mega menu panel --}} {{-- Mobile menu --}}
@foreach ($actions as $action) {{ $action['label'] ?? '' }} @endforeach
@once @endonce ```