web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Suggested answer

More levels for navigation-menu module

(0) ShareShare
ReportReport
Posted on by 35

I'm using the default navigation-menu module (@msdyn365-commerce-modules/navigation-menu, version 9.40.19). It's currently limited to 3 levels (clear by looking at @msdyn365-commerce-modules/navigation-menu/src/modules/navigation-menu/navigation-menu.definition.json).

Documentation: learn.microsoft.com/.../nav-menu-module

I need to have more levels, therefore I created a definition extension in my custom theme:

1. Create src/themes/<my-custom-theme>/definition-extensions/navigation-menu.definition.ext.json:

{
  "$type": "definitionExtension",
  "config": {
    "cmsNavItems": {
      "type": "array",
      "friendlyName": "Extended static menu items",
      "description": "If source allows manual authoring, you can configure the menu items",
      "items": {
        "$ref": "./MultiMenuItem.json#/definitions/menuItem"
      },
      "group": "Data source"
    }
  }
}

The $ref that I'm using looks like this:

{
    "definitions": {
        "menuItem": {
            "type": "object",
            "friendlyName": "Menu item",
            "description": "Menu item property",
            "properties": {
                "linkText": {
                    "type": "string",
                    "friendlyName": "Menu Item Text",
                    "description": "Text for Menu Item",
                    "default": "Menu Item Text "
                },
                "linkUrl": {
                    "type": "link",
                    "friendlyName": "Menu Item Link target",
                    "description": "Destination url for Menu Item Link",
                    "required": false
                },
                "image": {
                    "type": "image",
                    "friendlyName": "Menu Item Image",
                    "description": "Menu Item Image",
                    "required": false
                },
                "imageLink": {
                    "type": "link",
                    "friendlyName": "Menu Item Image Link",
                    "description": "Menu Item Image Link",
                    "required": false
                },
                "ariaLabel": {
                    "type": "string",
                    "friendlyName": "Menu item link aria label",
                    "description": "Aria Label for Menu Item Link",
                    "default": ""
                },
                "openInNewTab": {
                    "type": "boolean",
                    "friendlyName": "Open in new tab",
                    "description": "Open the link in a new tab",
                    "default": false
                },
                "subMenus": {
                    "type": "array",
                    "friendlyName": "List of Sub menus",
                    "description": "List of Sub menus",
                    "items": {
                        "type": "object",
                        "friendlyName": "Sub Menu Action Link",
                        "description": "Sub Menu Action Link property",
                        "properties": {
                            "linkText": {
                                "type": "string",
                                "friendlyName": "Sub menu link text",
                                "description": "Sub Menu Text for link",
                                "default": "Sub Menu Link text "
                            },
                            "linkUrl": {
                                "type": "link",
                                "friendlyName": "Sub Menu Link target",
                                "description": "Destination url for sub menu link",
                                "required": true
                            },
                            "ariaLabel": {
                                "type": "string",
                                "friendlyName": "Sub menu link aria label",
                                "description": "Aria Label for sub menu link",
                                "default": ""
                            },
                            "image": {
                                "type": "image",
                                "friendlyName": "Menu Item Image",
                                "description": "Menu Item Image",
                                "required": false
                            },
                            "imageLink": {
                                "type": "link",
                                "friendlyName": "Menu Item Image Link",
                                "description": "Menu Item Image Link",
                                "required": false
                            },
                            "subMenus": {
                                "type": "array",
                                "friendlyName": "List of Sub menus",
                                "description": "List of Sub menus",
                                "items": {
                                    "type": "object",
                                    "friendlyName": "Sub Menu Action Link",
                                    "description": "Sub Menu Action Link property",
                                    "properties": {
                                        "linkText": {
                                            "type": "string",
                                            "friendlyName": "Sub menu link text",
                                            "description": "Sub Menu Text for link",
                                            "default": "Sub Menu Link text "
                                        },
                                        "linkUrl": {
                                            "type": "link",
                                            "friendlyName": "Sub menu link target",
                                            "description": "Destination url for sub menu link",
                                            "required": true
                                        },
                                        "ariaLabel": {
                                            "type": "string",
                                            "friendlyName": "Sub menu link aria label",
                                            "description": "Aria Label for sub menu link",
                                            "default": ""
                                        },
                                        "image": {
                                            "type": "image",
                                            "friendlyName": "Menu Item Image",
                                            "description": "Menu Item Image",
                                            "required": false
                                        },
                                        "imageLink": {
                                            "type": "link",
                                            "friendlyName": "Menu Item Image Link",
                                            "description": "Menu Item Image Link",
                                            "required": false
                                        },
                                        "subMenus": {
                                            "type": "array",
                                            "friendlyName": "List of Sub menus",
                                            "description": "List of Sub menus",
                                            "items": {
                                                "type": "object",
                                                "friendlyName": "Sub Menu Action Link",
                                                "description": "Sub Menu Action Link property",
                                                "properties": {
                                                    "linkText": {
                                                        "type": "string",
                                                        "friendlyName": "Sub menu link text",
                                                        "description": "Sub Menu Text for link",
                                                        "default": "Sub Menu Link text "
                                                    },
                                                    "linkUrl": {
                                                        "type": "link",
                                                        "friendlyName": "Sub menu link target",
                                                        "description": "Destination url for sub menu link",
                                                        "required": true
                                                    },
                                                    "ariaLabel": {
                                                        "type": "string",
                                                        "friendlyName": "Sub menu link aria label",
                                                        "description": "Aria Label for sub menu link",
                                                        "default": ""
                                                    },
                                                    "image": {
                                                        "type": "image",
                                                        "friendlyName": "Menu Item Image",
                                                        "description": "Menu Item Image",
                                                        "required": false
                                                    },
                                                    "imageLink": {
                                                        "type": "link",
                                                        "friendlyName": "Menu Item Image Link",
                                                        "description": "Menu Item Image Link",
                                                        "required": false
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
 

It's basically a copy from @msdyn365-commerce-modules/definitions/dist/src/MenuItem.json#/definitions/menuItem with additional "subMenus" array definitions to get more navigation levels.

2. During the build I get the following console output:

-- config value 'cmsNavItems' already exists in parent definition. The property defined in extended definition will be applied

Sound correct, because I redefined an OOTB field.

Result: I get the default behavior with only 3 levels

Expectations: Sitebuilder should use my new custom override definition

FYI: I saw a similar discussion here:    - but it leads to more-less no solution.

I have the same question (0)
  • Suggested answer
    Daniel Koch Profile Picture
    35 on at
    RE: More levels for navigation-menu module

    After conversation with the Microsoft support I can answer this post:

    1. If you want to override a default definition field you need to set `override: true`, this is mentioned in the table on: learn.microsoft.com/.../configure-properties-context

    2. Will be fixed within the next releases

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 838

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 247 Super User 2025 Season 2

#3
Sagar Suman Profile Picture

Sagar Suman 235 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans