--- title: "navbar-03" description: "Navbar with a full-width mega menu: two grouped link columns plus a featured-articles panel. Mobile menu uses an expandable sheet." category: "Navbar" --- # navbar-03 Navbar with a full-width mega menu: two grouped link columns plus a featured-articles panel. Mobile menu uses an expandable sheet. ## Installation ```bash php artisan ui:add-block navbar-03 ``` ## 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-03.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 group is ['title' =>, 'items' => [...]] and each item is ['label' =>, 'description' =>, 'href' =>, 'icon' => '']. A featured item is ['label' =>, 'description' =>, 'href' =>, 'image' => url]; without an image it draws a grey placeholder. 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' => '#', 'links' => ['Link One', 'Link Two'], 'megaLabel' => 'Products', 'megaGroups' => null, 'featuredTitle' => 'From the blog', 'featured' => [ [ 'label' => 'Article title', 'description' => 'A short standfirst that previews the article and invites the reader in.', ], [ 'label' => 'Article title', 'description' => 'A short standfirst that previews the article and invites the reader in.', ], ], '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 => ''; $groups = $megaGroups ?? [ [ 'title' => 'Page group one', 'items' => [ [ '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( '', ), ], ], ], [ 'title' => 'Page group two', 'items' => [ [ '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 ```