Skip to Content
SettingsFeaturesNavigationMain Menu Configuration Interface Documentation

Main Menu Configuration Interface Documentation

Overview

This documentation describes the interface structure for a configurable menu system that supports both sidebar and top menu layouts, with customizable styling options.

Core Interfaces

IMainMenu

The root interface that defines the complete menu structure.

PropertyTypeDescription
settingsIMainMenuConfigurationGlobal configuration settings for the menu
itemsIMainMenuItem[]Array of menu items that compose the menu structure

IMainMenuConfiguration

Defines the overall configuration for the menu system.

PropertyTypeRequiredDescription
layoutMainMenuLayoutYesDefines the menu layout type (SIDEBAR or TOPMENU)
useLegacyMenubooleanNoWhen true, uses the legacy menu. Default: false (menu)
sidebarISidebarConfigurationNoConfiguration specific to sidebar layout
topMenuITopMenuConfigurationNoConfiguration specific to top menu layout
hideSpAppBarbooleanNoControls visibility of the SharePoint application bar
hamburguerMenuIHamburguerMenuConfigurationNoConfiguration for hamburger menu (legacy only)
isDisplaySearchbooleanNoControls visibility of search functionality
accessibleMenuIAccessibleMenuConfigurationNoMenu-specific callbacks. Property name kept for backwards compatibility

IAccessibleMenuConfiguration

ℹ️

This interface applies to the default Menu only. The property name accessibleMenu and interface name IAccessibleMenuConfiguration are kept as-is for backwards compatibility.

PropertyTypeDescription
onCloseMobileMenu() => voidCallback invoked when the mobile menu is closed

IMainMenuItem

Represents an individual menu item.

PropertyTypeDescription
uniqueIdstringUnique identifier for the menu item
textstring?Display text for the menu item
actionNamestring?Action identifier associated with the item (e.g., FAVORITES, BOOKMARKS)
ordernumberPosition order of the item. Lower numbers appear first
iconstring?Icon identifier — can be an Office UI Fabric icon name
expandedImagestring?Image URL to show when the menu is expanded (menu only)
urlstring?Navigation URL
openInNewTabboolean?Whether to open URL in new tab
parentIdstring?ID of parent menu item (used to build hierarchy)
isTopboolean?Whether item appears in the top section (true) or bottom section (false)
stylesIMainMenuItemStyles?Custom styles for this item (legacy menu only)
itemsIMainMenuItem[]?Nested child items (supports up to 3 levels in menu, 2 in legacy)
namestring?Alternative name identifier; used as fallback for text in menu

Style Configuration Interfaces

⚠️

The IMainMenuItemStyles and CSS interpolation styling are primarily used by the legacy menu. The menu uses theme-based colors from the Fluent UI theme palette.

IMainMenuItemStyles

Defines styling options for menu items (legacy menu).

PropertyTypeDescription
sidebarMenuInterpolation?Styles for sidebar menu container
itemInterpolation?Styles for menu item container
iconInterpolation?Styles for item icon
textInterpolation?Styles for item text
imgInterpolation?Styles for item images

ISidebarConfiguration

Configuration specific to sidebar layout.

PropertyTypeDescription
isCollapsablebooleanWhether sidebar can be collapsed. When false, the sidebar remains expanded (240px), the toggle is hidden, and defaultDisplay is ignored. When true, shows a toggle button and starts collapsed (rail at 60px)
collapsedMenuItemStyleIMainMenuItemStylesStyles for collapsed state (legacy)
expandedMenuItemStyleIMainMenuItemStylesStyles for expanded state (legacy)
selectedMenuItemCollapsedStyleInterpolationStyles for selected items when collapsed (legacy)
selectedMenuItemExpandedStyleInterpolationStyles for selected items when expanded (legacy)
sidebarExpandedStyleInterpolationStyles for expanded sidebar container (legacy)
sidebarCollapseStyleInterpolationStyles for collapsed sidebar container (legacy)
styleMenuItemIMainMenuItemStylesDefault styles for menu items (legacy)
defaultDisplayMenuDisplayDefault display state: COLLAPSED or EXPANDED (legacy only; menu always starts collapsed when collapsable)

ITopMenuConfiguration

Configuration specific to top menu layout.

PropertyTypeDescription
styleMenuItemIMainMenuItemStylesStyles for menu items (legacy)
selectedMenuItemStyleInterpolationStyles for selected menu items (legacy)

IHamburguerMenuConfiguration

Configuration for hamburger menu (legacy only).

PropertyTypeDescription
styleMenuItemIMainMenuItemStylesStyles for menu items
selectedMenuItemStyleInterpolationStyles for selected menu items

Enums

Defines possible menu layout types.

  • SIDEBAR: Vertical sidebar layout
  • TOPMENU: Horizontal top menu layout

Defines sidebar display states (legacy menu behavior).

  • COLLAPSED: Minimized sidebar state
  • EXPANDED: Full-width sidebar state

Defines possible positions for menu items.

  • TOP: Top position
  • BOTTOM: Bottom position
  • LEFT: Left position (alias for TOP)
  • RIGHT: Right position (alias for BOTTOM)

Usage Examples

const menuConfig: IMainMenu = { settings: { layout: MainMenuLayout.SIDEBAR, sidebar: { isCollapsable: true, }, }, items: [ { uniqueId: 'home', text: 'Home', order: 1, icon: 'Home', url: '/home', isTop: true, }, { uniqueId: 'docs', text: 'Documents', order: 2, icon: 'Document', isTop: true, items: [ { uniqueId: 'docs-shared', text: 'Shared Documents', order: 1, url: '/docs/shared', items: [ { uniqueId: 'docs-shared-recent', text: 'Recent', order: 1, url: '/docs/shared/recent', }, ], }, { uniqueId: 'docs-personal', text: 'My Documents', order: 2, url: '/docs/personal', }, ], }, { uniqueId: 'settings', text: 'Settings', order: 1, icon: 'Settings', url: '/settings', isTop: false, // Appears in bottom group }, ], };
const menuConfig: IMainMenu = { settings: { layout: MainMenuLayout.TOPMENU, }, items: [ { uniqueId: 'home', text: 'Home', order: 1, icon: 'Home', url: '/home', isTop: true, }, { uniqueId: 'links', text: 'Links', order: 2, icon: 'Link', isTop: true, items: [ { uniqueId: 'link-1', text: 'Microsoft SharePoint Blog', order: 1, url: 'https://techcommunity.microsoft.com/t5/sharepoint/ct-p/SharePoint', openInNewTab: true, }, ], }, ], };

Legacy menu — Sidebar with custom styles

const menuConfig: IMainMenu = { settings: { useLegacyMenu: true, layout: MainMenuLayout.SIDEBAR, hideSpAppBar: false, isDisplaySearch: true, sidebar: { isCollapsable: true, defaultDisplay: MenuDisplay.EXPANDED, sidebarExpandedStyle: 'background-color: #003f5f;', expandedMenuItemStyle: { icon: 'color: #ffffff;', text: 'color: #ffffff;', }, collapsedMenuItemStyle: { icon: 'color: #ffffff;', }, }, }, items: [ { uniqueId: 'home', text: 'Home', order: 1, icon: 'Home', url: '/home', }, ], };