Navbar
A site's top bar: a brand, links with dropdowns, and actions, folding into a menu on small screens.
Default
{component navbar,
title: 'Calico Library',
items: [
['title' => 'Home', 'href' => '#', 'active' => true],
['title' => 'Programs', 'items' => [
['title' => 'Kids', 'href' => '#'],
['title' => 'Teens', 'href' => '#'],
['title' => 'Adults', 'href' => '#'],
]],
['title' => 'Locations', 'href' => '#'],
],
}
{block actions}
{ui button, title: 'Sign in', icon: 'log-in', class: 'button-outline' /}
{/block}
{/component}
title is the brand's text, linking to href. items are the links, in the same shape as a menu: an item with its own items opens them in a dropdown, and active marks the current page, which gets aria-current. Buttons and other controls go in {block actions}. Below 768px the links fold into a Menu dropdown (its text is the menu param) and the actions stay in the bar.
Your own brand
{component navbar,
items: [
['title' => 'Docs', 'href' => '#'],
['title' => 'Pricing', 'href' => '#'],
],
}
{block brand}
<a
href="/"
class="flex items-center gap-2"
>
{ui avatar, initials: 'CL' /}
Calico
</a>
{/block}
{block actions}
{ui button, icon: 'search', class: 'button-icon button-ghost', attrs: ['aria-label' => 'Search'] /}
{/block}
{/component}
{block brand} replaces the brand, so it can hold a logo image or an avatar next to the name. It sits in the bar's first column, which takes the free width and pushes the links and actions to the right.
Brand and actions only
{component navbar, title: 'Covers'}
{block actions}
{ui button, title: 'Log in', href: '#', icon: 'log-in', class: 'button-ghost' /}
{/block}
{/component}
With no items there is no link row and no Menu dropdown, only the brand and the actions.