--- title: "navbar-01" description: "Classic top navbar with centered links, a dropdown, and dual call-to-action buttons. Collapses into a slide-in sheet on mobile." category: "Navbar" --- # navbar-01 Classic top navbar with centered links, a dropdown, and dual call-to-action buttons. Collapses into a slide-in sheet on mobile. ## Installation ```bash php artisan ui:add-block navbar-01 ``` ## 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: [dropdown-menu](https://laralcn-ui.abdulkadersafi.com/components/dropdown-menu.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-01.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' => ...]. 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. Variants are default, outline, secondary, ghost, link and destructive. Pass :menu-label="null" to drop the dropdown entirely. --}} @props([ 'brand' => 'LaralCN', 'brandHref' => '#', 'links' => ['Link One', 'Link Two', 'Link Three'], 'menuLabel' => 'Link Four', 'menuLinks' => ['Link Five', 'Link Six', 'Link Seven'], 'actions' => [ ['label' => 'Sign in', 'href' => null, 'variant' => 'outline'], ['label' => 'Get Started', 'href' => null, 'variant' => 'default'], ], ]) @php $link = static fn($item): array => is_array($item) ? $item + ['href' => '#'] : ['label' => $item, 'href' => '#']; @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 --}} {{-- Mobile menu --}}
@foreach ($actions as $action) {{ $action['label'] ?? '' }} @endforeach
```