menu-id
obtained from the Admin Panel.
In this base theme, you can take a look at header.tsx
file to view a working example of the same.
<ul>
) and list items (<li>
). Each list item represents a menu item or a link in the navigation. This structure provides a semantic and accessible way to represent a navigation menu.
Props | Description |
---|---|
menuLinkObj | An object contains the id of the navigation created in Admin Panel. e.g. In the Header component, you can see that we are retrieving data from the pageData object, and within that, we access the globalSettings property which contains information about the header . This is where the navigation menu ID is specified. |
ulClasses | To style the main <ul> element of the navigation menu, apply a CSS class using the className attribute. |
liClasses | It works same way as ulClasses but for the list-item (<li> ). |
linkNameClasses | Accepts the name of class(es) to apply on the <Link /> tag. You can view how <Link> works in base-theme at Link Parser. |
childMenuItem | The ExpMenu component works recursively. Whenever a child menu is created, the ExpMenu component is called again, which in turn returns a child <ul> element. This recursive behavior allows for the creation of nested menus or submenus within the navigation menu structure. |
keyValueForMenu | In the header menu, the data is being fetched from pageData.globalSettings.header_com . The header_com object contains all the information about the header component, including the menu ID. To access the menu ID, you need to provide the corresponding key. Take a look at Header Menu Object, In our case it will be primary_navigation_id_et . |
iconForNavChild | You can provide an icon which you want to show in the menu item. |
index | In the context of recursion, the index parameter refers to the level of recursion being performed. By providing an initial value of zero, it will be incremented by one with each recursive call. This can be useful for tracking the depth or level of the recursion and performing specific actions or applying different styles based on the current recursion level. |
header.tsx
and menu.tsx
in the base theme for a detailed understanding of how the index
parameter is used in the code.