[SalesForce] salesforce custom lightning Horizontal navigation

I am working on a requirement now to develop a custom component for navigation menu. We are using custom "Build Your Own" Community Template . And the standard navigation (Horizontal) is not available in drag and drop . I need to replicate the navigation bar as below.
Expected Result

I am using the below code

<aura:component extends="forceCommunity:navigationMenuBase" implements="forceCommunity:availableForAllPageTypes" access="global">
   <div class="slds-grid slds-grid--horizontal slds-navigation-list--horizontal">
       <ul onclick="{!c.onClick}">
           <aura:iteration items="{!v.menuItems}" var="item">
               <li class="{!item.active ? 'slds-is-active' : ''}">
                   <a href="javascript:void(0);" data-menu-item-id="{!item.id}" class="slds-navigation-list--vertical__action slds-text-link--reset">
                       {!item.label}
                   </a>
               </li>
           </aura:iteration>
       </ul>
   </div>
</aura:component>

I am getting the result as below. Is there anything I am missing to . Is it possible to make the navigation menus be visible side-by-side.
Result I am getting

Best Answer

What you need here is the appropriate SLDS class to be able to render your list items horizontally.

Add the Horizontal List SLDS class where you are rendering your list, and that should work. Your code should look like as below.

<ul class="slds-list_horizontal" onclick="{!c.onClick}">
    ....
</ul>

A sample code and its output for reference.

<ul class="slds-list_horizontal">
    <li>Menu1&nbsp;</li>
    <li>Menu2&nbsp;</li>
    <li>Menu3&nbsp;</li>
</ul>

enter image description here

Related Topic