EN
Getting started
09 · Menu

Menu items

The parts of the vertical menu: section heading, link, group with a submenu, third-level subgroup and the "Coming soon" item. Groups work like an accordion; since the group of the active page is rendered open on the server, the menu looks right even before Alpine loads.

acun:nav.*
02

Groups

acun:nav.group lists its sub-links (acun:nav.sub-item) with a thin guide line on the left. Only one group stays open at a time: opening a group closes the others. Pass active to the group that contains the active page; that group is open when the page loads.

LIVE EXAMPLE
<nav class="flex flex-col gap-0.5 px-3">
    <acun:nav.group title="Customers" active>
        <acun:slot:icon><acun:icon name="users" /></acun:slot:icon>
        <acun:nav.sub-item href="#" title="Customer List" active />
        <acun:nav.sub-item href="#" title="Customer Groups" />
    </acun:nav.group>
    <acun:nav.group title="Reports">
        <acun:slot:icon><acun:icon name="document-text" /></acun:slot:icon>
        <acun:nav.sub-item href="#" title="Sales Report" />
        <acun:nav.sub-item href="#" title="Stock Report" />
    </acun:nav.group>
</nav>
PropValues
group: titleGroup name (required)
group: activetrue | false
sub-item: href, title, activeSub-link; highlighted on the guide line when active
03

Third level

If a group needs a further breakdown, use acun:nav.sub-group. It is listed one step further in with its own guide line and opens and closes on click; if the active page is inside it, active makes it open.

LIVE EXAMPLE
<nav class="flex flex-col gap-0.5 px-3">
    <acun:nav.group title="Definitions" active>
        <acun:slot:icon><acun:icon name="cog-6-tooth" /></acun:slot:icon>
        <acun:nav.sub-item href="#" title="Carriers" />
        <acun:nav.sub-group title="Address" active>
            <acun:nav.sub-item href="#" title="Districts" active />
            <acun:nav.sub-item href="#" title="Neighborhoods" />
        </acun:nav.sub-group>
    </acun:nav.group>
</nav>
PropValues
sub-group: titleSubgroup name (required)
sub-group: activetrue | false
04

Badges

badge adds a number or a short label to the right of the item; for things like the number of pending tasks or a "New" notice. It works on every level of the menu: acun:nav.item, acun:nav.group, acun:nav.sub-group and acun:nav.sub-item. If you build the menu from JSON, acun:menu passes the item's badge value to the same component.

LIVE EXAMPLE
<nav class="flex flex-col gap-0.5 px-3">
    <acun:nav.item href="#" title="Support tickets" badge="12">
        <acun:slot:icon><acun:icon name="inbox" /></acun:slot:icon>
    </acun:nav.item>
    <acun:nav.group title="Imports" badge="New" active>
        <acun:slot:icon><acun:icon name="arrow-up-tray" /></acun:slot:icon>
        <acun:nav.sub-item href="#" title="Product Import from Excel" badge="3" />
        <acun:nav.sub-group title="Pending" badge="5" active>
            <acun:nav.sub-item href="#" title="Awaiting approval" badge="2" />
        </acun:nav.sub-group>
    </acun:nav.group>
</nav>
PropValues
badgeNumber or short text; not shown when null
05

Coming soon

acun: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.

LIVE EXAMPLE
<nav class="flex flex-col gap-0.5 px-3">
    <acun:nav.group title="Training" active>
        <acun:slot:icon><acun:icon name="academic-cap" /></acun:slot:icon>
        <acun:nav.sub-item href="#" title="Frequently asked questions" />
        <acun:nav.coming-soon title="Training videos" />
        <acun:nav.coming-soon title="Live support" label="March" />
    </acun:nav.group>
</nav>
PropValues
coming-soon: labelLabel on the right; defaults to "Coming soon"
API

Props and slots

The values the component accepts.

PropDefaultDescription
nav.heading: firstfalseReduces 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: activefalseActive page; highlight and aria-current="page"
nav.item: badgenullNumber or short label on the right
nav.item: targetnull'_blank' opens it in a new tab (wire:navigate is not used); adds an arrow icon and a screen reader note
nav.item: externalfalseSame as target='_blank': new tab, arrow icon and screen reader note
nav.group: title — Group name (required)
nav.group: activefalseThe group is rendered open and highlighted on the server
nav.group: badgenullNumber or short label on the right
nav.sub-group: title — Name of the third-level, collapsible subgroup (required)
nav.sub-group: activefalseThe subgroup is rendered open and highlighted on the server
nav.sub-group: badgenullNumber 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, externalfalse · null · null · falseSame as nav.item
nav.sub-item: compactfalseBoxed look for the horizontal menu panel
nav.coming-soon: title — Item name (required)
nav.coming-soon: label, compactnull · falseLabel 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
Acun UI · Menu itemsDetailed usage and examples