Menu items
The parts of the vertical menu: section heading, link, group with a submenu, third-level subgroup and the "Coming soon" item.
zb:nav.* zubazar/ui-pro
This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →
Headings and links
zb:nav.heading divides the menu into sections and zb:nav.item is a link; pass active on the active page.
<nav class="flex flex-col gap-0.5 px-3">
<zb:nav.heading first>General</zb:nav.heading>
<zb:nav.item href="#" title="Home" active>
<zb:slot:icon><zb:icon name="home" /></zb:slot:icon>
</zb:nav.item>
<zb:nav.heading>Reports</zb:nav.heading>
<zb:nav.item href="#" title="Sales report">
<zb:slot:icon><zb:icon name="chart-bar" /></zb:slot:icon>
</zb:nav.item>
</nav>
| Prop | Values |
|---|---|
heading: first | true | false |
item: href, title | Link URL and text (required) |
item: active | true | false |
Groups
zb:nav.group gathers sub-links (zb:nav.sub-item) in a collapsible group; pass active to the group of the active page.
<nav class="flex flex-col gap-0.5 px-3">
<zb:nav.group title="Customers" active>
<zb:slot:icon><zb:icon name="users" /></zb:slot:icon>
<zb:nav.sub-item href="#" title="Customer List" active />
<zb:nav.sub-item href="#" title="Customer Groups" />
</zb:nav.group>
<zb:nav.group title="Reports">
<zb:slot:icon><zb:icon name="document-text" /></zb:slot:icon>
<zb:nav.sub-item href="#" title="Sales Report" />
<zb:nav.sub-item href="#" title="Stock Report" />
</zb:nav.group>
</nav>
| Prop | Values |
|---|---|
group: title | Group name (required) |
group: active | true | false |
sub-item: href, title, active | Sub-link; highlighted on the guide line when active |
Third level
If a group needs one more level, use zb:nav.sub-group; if the active page is inside it, active makes it open.
<nav class="flex flex-col gap-0.5 px-3">
<zb:nav.group title="Definitions" active>
<zb:slot:icon><zb:icon name="cog-6-tooth" /></zb:slot:icon>
<zb:nav.sub-item href="#" title="Carriers" />
<zb:nav.sub-group title="Address" active>
<zb:nav.sub-item href="#" title="Districts" active />
<zb:nav.sub-item href="#" title="Neighborhoods" />
</zb:nav.sub-group>
</zb:nav.group>
</nav>
| Prop | Values |
|---|---|
sub-group: title | Subgroup name (required) |
sub-group: active | true | false |
Badges
badge adds a number or a short label such as "New" to the right of the item.
<nav class="flex flex-col gap-0.5 px-3">
<zb:nav.item href="#" title="Support tickets" badge="12">
<zb:slot:icon><zb:icon name="inbox" /></zb:slot:icon>
</zb:nav.item>
<zb:nav.group title="Imports" badge="New" active>
<zb:slot:icon><zb:icon name="arrow-up-tray" /></zb:slot:icon>
<zb:nav.sub-item href="#" title="Product Import from Excel" badge="3" />
<zb:nav.sub-group title="Pending" badge="5" active>
<zb:nav.sub-item href="#" title="Awaiting approval" badge="2" />
</zb:nav.sub-group>
</zb:nav.group>
</nav>
| Prop | Values |
|---|---|
badge | Number or short text; not shown when null |
Coming soon
zb:nav.coming-soon shows a page that is not ready yet as non-clickable, with a "Coming soon" label on its right; change the label with label.
<nav class="flex flex-col gap-0.5 px-3">
<zb:nav.group title="Training" active>
<zb:slot:icon><zb:icon name="academic-cap" /></zb:slot:icon>
<zb:nav.sub-item href="#" title="Frequently asked questions" />
<zb:nav.coming-soon title="Training videos" />
<zb:nav.coming-soon title="Live support" label="March" />
</zb:nav.group>
</nav>
| Prop | Values |
|---|---|
coming-soon: label | Label on the right; defaults to "Coming soon" |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
nav.heading: first | boolean | false | Reduces the top spacing of the first heading; the heading text comes from the slot |
nav.item: href, title | — | — | Link URL and text (required) |
nav.item: active | boolean | false | Active page; highlight and aria-current="page" |
nav.item: badge | — | null | Number or short label on the right |
nav.item: target | — | null | '_blank' opens it in a new tab (wire:navigate is not used); adds an arrow icon and a screen reader note |
nav.item: external | boolean | false | Same as target='_blank': new tab, arrow icon and screen reader note |
nav.group: title | — | — | Group name (required) |
nav.group: active | boolean | false | The group is rendered open and highlighted on the server |
nav.group: badge | — | null | Number or short label on the right |
nav.sub-group: title | — | — | Name of the third-level, collapsible subgroup (required) |
nav.sub-group: active | boolean | false | The subgroup is rendered open and highlighted on the server |
nav.sub-group: badge | — | null | Number or short label on the right |
nav.sub-item: href, title | — | — | URL and text of the sub-link (required) |
nav.sub-item: active, badge, target, external | — | false · null · null · false | Same as nav.item |
nav.sub-item: compact | boolean | false | Boxed look for the horizontal menu panel |
nav.coming-soon: title | — | — | Item name (required) |
nav.coming-soon: label, compact | — | null · false | Label text ("Coming soon"); boxed look for the horizontal menu panel |
(attributes) | — | — | class, data-*, wire:key, wire:click … are added to the element itself on item, sub-item, coming-soon and heading (class is merged), and to the wrapping div on group and sub-group |
Slots: nav.item and nav.group: icon · nav.group and nav.sub-group: default (child items) · nav.heading: heading text
Advanced
External link
On links that leave the application, pass external (or target="_blank"): the link opens in a new tab and does not use wire:navigate. A small arrow is added after the name, and screen readers are told "(opens in a new tab)".
<nav class="flex flex-col gap-0.5 px-3">
<zb:nav.item href="https://laravel.com/docs" title="Laravel docs" external>
<zb:slot:icon><zb:icon name="book-open" /></zb:slot:icon>
</zb:nav.item>
<zb:nav.group title="Help" active>
<zb:slot:icon><zb:icon name="question-mark-circle" /></zb:slot:icon>
<zb:nav.sub-item href="#" title="User guide" external />
</zb:nav.group>
</nav>
| Prop | Values |
|---|---|
external | true | false |
target | _blank (same as external) |
Developer notes
- Groups work like an accordion: only one group stays open at a time. Since the group of the active page is rendered open on the server, the menu looks right even before Alpine loads.
- Pass
firston the first heading to reduce its top spacing; an item's icon comes from theiconslot. The active item is highlighted and getsaria-current="page". - In the collapsed menu, headings are hidden and item names show as tooltips.
badgeworks on every level of the menu (nav.item,nav.group,nav.sub-group,nav.sub-item); if you build the menu from JSON,zb:menupasses the item'sbadgevalue to the same component.externalworks onzb:nav.item,zb:nav.sub-itemandzb:nav.horizontal-item.