Guides
Navigation
Feedback
Overlays
Layout
Data Display
Forms
.md

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.

Open full screen →

Installation

php artisan ui:add-block navbar-03

A single command installs the block's Blade file and every component it depends on. Render it in your own layout as <x-ui.blocks.navbar-03 />.

Components it includes

Usage

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' => '<svg ...>']. 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.

<x-ui.blocks.navbar-03
    brand="Acme"
    :links="[
        ['label' => 'Pricing', 'href' => '/pricing'],
        ['label' => 'Customers', 'href' => '/customers'],
    ]"
    mega-label="Platform"
    :mega-groups="[
        ['title' => 'Build', 'items' => [
            ['label' => 'Deployments', 'description' => 'Ship on every push.', 'href' => '/deploy', 'icon' => '<svg viewBox=\'0 0 24 24\'>...</svg>'],
            ['label' => 'Previews', 'description' => 'A URL per pull request.', 'href' => '/previews'],
        ]],
        ['title' => 'Operate', 'items' => [
            ['label' => 'Monitoring', 'description' => 'Know before your users do.', 'href' => '/monitoring'],
            ['label' => 'Rollbacks', 'description' => 'One click back to safety.', 'href' => '/rollbacks'],
        ]],
    ]"
    featured-title="From the blog"
    :featured="$posts->map(fn ($post) => [
        'label' => $post->title,
        'description' => $post->excerpt,
        'href' => route('posts.show', $post),
        'image' => $post->cover_url,
    ])->all()"
    :actions="[
        ['label' => 'Sign in', 'href' => route('login'), 'variant' => 'ghost'],
        ['label' => 'Start free', 'href' => route('register'), 'variant' => 'default'],
    ]"
/>

Props

Every prop with its default. Pass any of them as attributes, using : to bind a PHP value.

@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'],
    ],
])