mode decides whether a submenu expands in place or opens as a popup. It defaults to vertical.
- inline is the sidebar shape. A submenu expands in place and pushes the items below it down, so the menu grows as submenus open. It is the only mode inlineCollapsed works with.
- vertical looks like inline until you hover a submenu. The submenu opens as a popup to the side, so the menu keeps its height however deep the tree is.
- horizontal is the header shape. Submenus open below their item as popups, and items that do not fit move into one trailing submenu.
Pick the mode from the layout. Switching away from inline closes every submenu and calls onOpenChange with an empty array. They open again when you switch back, so a menu that changes mode at a breakpoint loses its open submenus on the way out and gets them back on the way in.