Horizontal menu
The top menu of the horizontal layout: single links and groups with a dropdown panel.
zb:nav.horizontal-* zubazar/ui-pro
This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →
Basic usage
zb:nav.horizontal-item is a single link and zb:nav.horizontal-group a group with a dropdown panel.
<nav class="flex h-12 items-center gap-1">
<zb:nav.horizontal-item href="#" title="Home" />
<zb:nav.horizontal-group title="Customers">
<zb:nav.sub-item compact href="#" title="Customer List" />
</zb:nav.horizontal-group>
<zb:nav.horizontal-group title="Imports">
<zb:nav.sub-item compact href="#" title="Product Import from Excel" />
<zb:nav.coming-soon compact title="Users from Excel" />
</zb:nav.horizontal-group>
</nav>
| Prop | Values |
|---|---|
horizontal-item: href, title | Link URL and text (required) |
horizontal-group: title | Group name (required) |
sub-item: compact | true (inside the panel) |
Active page
Pass active to the active link or to the group that contains the active page; a thin accent line appears below it.
<nav class="flex h-12 items-center gap-1">
<zb:nav.horizontal-item href="#" title="Home" />
<zb:nav.horizontal-group title="Reports" active>
<zb:nav.sub-item compact href="#" title="Sales Report" active />
<zb:nav.sub-item compact href="#" title="Stock Report" />
</zb:nav.horizontal-group>
<zb:nav.horizontal-item href="#" title="Orders" />
</nav>
| Prop | Values |
|---|---|
active | true | false |
Badges
badge shows a number or a short label after the name of the link or group.
<nav class="flex h-12 items-center gap-1">
<zb:nav.horizontal-item href="#" title="Support tickets" badge="12" />
<zb:nav.horizontal-group title="Imports" badge="New">
<zb:nav.sub-item compact href="#" title="Product Import from Excel" badge="3" />
<zb:nav.sub-item compact href="#" title="Import history" />
</zb:nav.horizontal-group>
</nav>
| Prop | Values |
|---|---|
badge | Number or short text; not shown when null |
Groups on the right edge
For groups at the right end of the menu (e.g. Settings), pass align="right" so the panel does not overflow the screen.
<nav class="flex h-12 items-center gap-1">
<zb:nav.horizontal-item href="#" title="Home" />
<div class="flex-1"></div>
<zb:nav.horizontal-group title="Settings" align="right">
<zb:nav.sub-item compact href="#" title="Users" />
<zb:nav.sub-item compact href="#" title="Permissions" />
</zb:nav.horizontal-group>
</nav>
| Prop | Values |
|---|---|
align | left | right |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
horizontal-item: href, title | — | — | Link URL and text (required) |
horizontal-item: active | boolean | false | Accent line below it and aria-current="page" |
horizontal-item: target | — | null | '_blank' opens it in a new tab (wire:navigate is not used); adds an arrow icon and a screen reader note |
horizontal-item: external | boolean | false | Same as target='_blank': new tab, arrow icon and screen reader note |
horizontal-item: badge | — | null | Number or short label after the name |
horizontal-group: title | — | — | Group name (required) |
horizontal-group: active | boolean | false | Group that contains the active page; accent line |
horizontal-group: align | — | left | left · right (alignment of the panel) |
horizontal-group: badge | — | null | Number or short label after the name |
sub-item: badge | — | null | Badge of the sub-item in the panel |
sub-item: compact | boolean | false | Boxed look inside the panel; pass true in the horizontal menu |
coming-soon: compact | boolean | false | Boxed look inside the panel |
(attributes) | — | — | class, data-*, wire:key … are added to the link itself on horizontal-item (class is merged) and to the wrapping div on horizontal-group |
Slots: horizontal-item and horizontal-group: icon · horizontal-group: default (panel items)
Advanced
Icons
Both items accept the icon slot; the icon is placed to the left of the text. Since space is tight in the top menu, keep icons small with size="4".
<nav class="flex h-12 items-center gap-1">
<zb:nav.horizontal-item href="#" title="Home" active>
<zb:slot:icon><zb:icon name="home" size="4" /></zb:slot:icon>
</zb:nav.horizontal-item>
<zb:nav.horizontal-group title="Customers">
<zb:slot:icon><zb:icon name="users" size="4" /></zb:slot:icon>
<zb:nav.sub-item compact href="#" title="Customer List" />
</zb:nav.horizontal-group>
</nav>
External link
A top menu link or panel sub-item given external opens in a new tab (same as target="_blank"), does not use wire:navigate and shows a small arrow icon after its name. Screen readers also announce that the link opens in a new tab.
<nav class="flex h-12 items-center gap-1">
<zb:nav.horizontal-item href="#" title="Home" />
<zb:nav.horizontal-item href="https://laravel.com/docs" title="Docs" external />
<zb:nav.horizontal-group title="Help">
<zb:nav.sub-item compact href="#" title="User guide" external />
</zb:nav.horizontal-group>
</nav>
| Prop | Values |
|---|---|
external | true | false |
Developer notes
- The panel opens on mouse hover or when keyboard focus moves into it; no JavaScript is needed.
- For the links in the panel, use
zb:nav.sub-itemandzb:nav.coming-soonwithcompact. - In the layout the menu fills the height of the top bar; in the example this height is set with
h-12. - The active sub-item in the panel is marked with a gray background.
- You can pass
badgeto the sub-items in the panel too;zb:menupasses thebadgevalue in the JSON to the horizontal items as well.