EN
Getting started
10 · Menu

Horizontal menu

The top menu of the horizontal layout: single links and groups with a dropdown panel. The panel opens on mouse hover or when keyboard focus moves into it; no JavaScript is needed.

acun:nav.horizontal-*
01

Basic usage

acun:nav.horizontal-item is a single link and acun:nav.horizontal-group is a group with a dropdown panel. For the links in the panel, use acun:nav.sub-item and acun:nav.coming-soon with compact. In the layout, the menu fills the height of the top bar; in the example this height is set with h-12.

LIVE EXAMPLE
<nav class="flex h-12 items-center gap-1">
    <acun:nav.horizontal-item href="#" title="Home" />
    <acun:nav.horizontal-group title="Customers">
        <acun:nav.sub-item compact href="#" title="Customer List" />
        <acun:nav.sub-item compact href="#" title="Customer Groups" />
    </acun:nav.horizontal-group>
    <acun:nav.horizontal-group title="Imports">
        <acun:nav.sub-item compact href="#" title="Product Import from Excel" />
        <acun:nav.coming-soon compact title="Users from Excel" />
    </acun:nav.horizontal-group>
</nav>
PropValues
horizontal-item: href, titleLink URL and text (required)
horizontal-group: titleGroup name (required)
sub-item: compacttrue (inside the panel)
02

Active page

Pass active to the active link or to the group that contains the active page; a thin line in the accent color appears below it. In the panel, the active sub-item in the compact look is marked with a gray background.

LIVE EXAMPLE
<nav class="flex h-12 items-center gap-1">
    <acun:nav.horizontal-item href="#" title="Home" />
    <acun:nav.horizontal-group title="Reports" active>
        <acun:nav.sub-item compact href="#" title="Sales Report" active />
        <acun:nav.sub-item compact href="#" title="Stock Report" />
    </acun:nav.horizontal-group>
    <acun:nav.horizontal-item href="#" title="Orders" />
</nav>
PropValues
activetrue | false
03

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".

LIVE EXAMPLE
<nav class="flex h-12 items-center gap-1">
    <acun:nav.horizontal-item href="#" title="Home" active>
        <acun:slot:icon><acun:icon name="home" size="4" /></acun:slot:icon>
    </acun:nav.horizontal-item>
    <acun:nav.horizontal-group title="Customers">
        <acun:slot:icon><acun:icon name="users" size="4" /></acun:slot:icon>
        <acun:nav.sub-item compact href="#" title="Customer List" />
    </acun:nav.horizontal-group>
</nav>
04

Badges

badge shows a number or a short label after the name of the link or group; it looks the same as the badges in the vertical menu. You can also pass badge to the sub-items in the panel. acun:menu passes the badge value from the JSON to horizontal items as well.

LIVE EXAMPLE
<nav class="flex h-12 items-center gap-1">
    <acun:nav.horizontal-item href="#" title="Support tickets" badge="12" />
    <acun:nav.horizontal-group title="Imports" badge="New">
        <acun:nav.sub-item compact href="#" title="Product Import from Excel" badge="3" />
        <acun:nav.sub-item compact href="#" title="Import history" />
    </acun:nav.horizontal-group>
</nav>
PropValues
badgeNumber or short text; not shown when null
06

Groups on the right edge

By default the panel opens from the left edge of the group. For groups at the right end of the menu (e.g. Settings), pass align="right" so the panel does not overflow the screen.

LIVE EXAMPLE
<nav class="flex h-12 items-center gap-1">
    <acun:nav.horizontal-item href="#" title="Home" />
    <div class="flex-1"></div>
    <acun:nav.horizontal-group title="Settings" align="right">
        <acun:nav.sub-item compact href="#" title="Users" />
        <acun:nav.sub-item compact href="#" title="Permissions" />
    </acun:nav.horizontal-group>
</nav>
PropValues
alignleft | right
07

With a JSON menu

If the menu comes from a JSON file, use the acun:menu component with horizontal instead of writing the items one by one; section headings are skipped in the horizontal menu.

BLADE
<acun:slot:nav>
    <acun:menu menu="main" horizontal />
</acun:slot:nav>

<acun:slot:mobileNav>
    <acun:menu menu="main" />
</acun:slot:mobileNav>
API

Props and slots

The values the component accepts.

PropDefaultDescription
horizontal-item: href, title — Link URL and text (required)
horizontal-item: activefalseAccent line below it and aria-current="page"
horizontal-item: targetnull'_blank' opens it in a new tab (wire:navigate is not used); adds an arrow icon and a screen reader note
horizontal-item: externalfalseSame as target='_blank': new tab, arrow icon and screen reader note
horizontal-item: badgenullNumber or short label after the name
horizontal-group: title — Group name (required)
horizontal-group: activefalseGroup that contains the active page; accent line
horizontal-group: alignleftleft · right (alignment of the panel)
horizontal-group: badgenullNumber or short label after the name
sub-item: badgenullBadge of the sub-item in the panel
sub-item: compactfalseBoxed look inside the panel; pass true in the horizontal menu
coming-soon: compactfalseBoxed 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)
Acun UI · Horizontal menuDetailed usage and examples