diff --git a/samples/BlazorServerSide/Pages/Index.razor b/samples/BlazorServerSide/Pages/Index.razor
index c122431..54587eb 100644
--- a/samples/BlazorServerSide/Pages/Index.razor
+++ b/samples/BlazorServerSide/Pages/Index.razor
@@ -2,4 +2,56 @@
Hello, world!
-Welcome to your new app.
+Samples of a multi-level submenu below:
+
+
+
+
+
+
+
+@**@
+
+
+
+@code {
+ MenuBuilder MenuBuilder1 = new MenuBuilder();
+ MenuBuilder MenuBuilder2 = new MenuBuilder();
+
+ protected override void OnInitialized()
+ {
+ MenuBuilder1
+ .AddIconCssToClose("oi oi-chevron-top pt-3")
+ .AddIconCssToOpen("oi oi-chevron-bottom pt-3")
+ .AddItem(1, "Home", "/", match: NavLinkMatch.All)
+ .AddItem(2, "Counter", "counter", isEnabled: false)
+ .AddSubMenu(3, "Sub Menu sotto", new MenuBuilder()
+ .AddItem(1, "Counter", "counter")
+ .AddItem(2, "Fetch Data", "fetchdata", isEnabled: false)
+ .AddItem(3, "You Can't See Me", "invisible", isVisible: false))
+ .AddSubMenu(4, "another sub menu", new MenuBuilder()
+ .AddItem(1, "Counter", "counter")
+ .AddItem(2, "Fetch Data", "fetchdata")
+ .AddItem(3, "Paperino", "paperino")
+ .AddSubMenu(4, "another subsubmenu", new MenuBuilder()
+ .AddItem(1, "Counter", "counter")))
+ .AddItem(5, "FetchData", "fetchdata");
+
+ MenuBuilder2
+ .AddIconCssToClose("oi oi-chevron-top pt-3")
+ .AddIconCssToOpen("oi oi-chevron-bottom pt-3")
+ .AddItem(1, "Home", "/", match: NavLinkMatch.All)
+ .AddItem(2, "Counter", "counter", isEnabled: false)
+ .AddSubMenu(3, "1st level submenu", new MenuBuilder()
+ .AddItem(1, "Counter", "counter")
+ .AddItem(2, "Fetch Data", "fetchdata", isEnabled: false)
+ .AddItem(3, "You Can't See Me", "invisible", isVisible: false)
+ .AddSubMenu(4, "2nd level submenu", new MenuBuilder()
+ .AddItem(1, "Counter", "counter"))
+ .AddSubMenu(2, "3rd level submenu", new MenuBuilder()
+ .AddItem(1, "Counter", "counter")
+ .AddSubMenu(2, "4th level submenu", new MenuBuilder()
+ .AddItem(1, "Counter", "counter"))))
+ .AddItem(4, "FetchData", "fetchdata");
+ }
+}
\ No newline at end of file
diff --git a/samples/BlazorServerSide/Shared/NavMenu.razor b/samples/BlazorServerSide/Shared/NavMenu.razor
index bbe0a72..0e43e8b 100644
--- a/samples/BlazorServerSide/Shared/NavMenu.razor
+++ b/samples/BlazorServerSide/Shared/NavMenu.razor
@@ -16,7 +16,7 @@
- Counter
+ Counter
Fetch data
@@ -40,22 +40,27 @@
+
+
+
+
@code {
MenuBuilder MenuBuilder = new MenuBuilder();
protected override void OnInitialized()
{
- MenuBuilder.AddItem(1, "Home", "/", match: NavLinkMatch.All)
- .AddItem(2, "Counter", "counter", isEnabled: false)
- .AddSubMenu(3, "Sub Menu", new MenuBuilder().AddItem(1, "Counter", "counter")
- .AddItem(2, "Fetch Data", "fetchdata", isEnabled: false)
- .AddItem(3, "You Can't See Me", "invisible", isVisible: false))
- .AddItem(4, "FetchData", "fetchdata")
- .AddIconCssToClose("oi oi-chevron-top pt-3")
- .AddIconCssToOpen("oi oi-chevron-bottom pt-3")
- ;
+ MenuBuilder
+ .AddIconCssToClose("oi oi-chevron-top pt-3")
+ .AddIconCssToOpen("oi oi-chevron-bottom pt-3")
+ .AddItem(1, "Home", "/", match: NavLinkMatch.All)
+ .AddItem(2, "Counter", "counter", isEnabled: false)
+ .AddSubMenu(3, "Sub Menu", new MenuBuilder()
+ .AddItem(1, "Counter", "counter")
+ .AddItem(2, "Fetch Data", "fetchdata", isEnabled: false)
+ .AddItem(3, "You Can't See Me", "invisible", isVisible: false))
+ .AddItem(4, "FetchData", "fetchdata");
}
-}
+}
\ No newline at end of file
diff --git a/samples/BlazorWebAssembly/Pages/Index.razor b/samples/BlazorWebAssembly/Pages/Index.razor
index c122431..7fc41b4 100644
--- a/samples/BlazorWebAssembly/Pages/Index.razor
+++ b/samples/BlazorWebAssembly/Pages/Index.razor
@@ -3,3 +3,33 @@
Hello, world!
Welcome to your new app.
+
+
+
+Multi-sublevel menu sample:
+
+
+
+@code {
+ MenuBuilder MenuBuilder = new MenuBuilder();
+
+ protected override void OnInitialized()
+ {
+ MenuBuilder
+ .AddItem(1, "Home", "/", match: NavLinkMatch.All)
+ .AddItem(2, "Counter", "counter", isEnabled: false)
+ .AddSubMenu(3, "1st level submenu", new MenuBuilder()
+ .AddItem(1, "Counter", "counter")
+ .AddItem(2, "Fetch Data", "fetchdata", isEnabled: false)
+ .AddItem(3, "You Can't See Me", "invisible", isVisible: false)
+ .AddSubMenu(4, "2nd level submenu", new MenuBuilder()
+ .AddItem(1, "Counter", "counter")
+ .AddSubMenu(2, "3rd level submenu", new MenuBuilder()
+ .AddItem(1, "Counter", "counter")
+ .AddSubMenu(2, "4th level submenu", new MenuBuilder()
+ .AddItem(1, "Counter", "counter")))))
+ .AddItem(4, "FetchData", "fetchdata")
+ .AddIconCssToClose("oi oi-chevron-top pt-3")
+ .AddIconCssToOpen("oi oi-chevron-bottom pt-3");
+ }
+}
\ No newline at end of file
diff --git a/src/Blazored.Menu/BlazoredSubMenu.razor b/src/Blazored.Menu/BlazoredSubMenu.razor
index 852e8d7..414f90a 100644
--- a/src/Blazored.Menu/BlazoredSubMenu.razor
+++ b/src/Blazored.Menu/BlazoredSubMenu.razor
@@ -1,30 +1,38 @@
@inherits BlazoredSubMenuBase
@using Microsoft.AspNetCore.Components.Web
-
- @if (HeaderTemplate != null)
+
+ @if (HeaderTemplate != null)
+ {
+ @HeaderTemplate @Icon
+ }
+ else
+ {
+ @Header @Icon
+ }
+
+
\ No newline at end of file
+ }
+
+
\ No newline at end of file
diff --git a/src/Blazored.Menu/wwwroot/blazored-menu.css b/src/Blazored.Menu/wwwroot/blazored-menu.css
index fadcf41..1d9cb69 100644
--- a/src/Blazored.Menu/wwwroot/blazored-menu.css
+++ b/src/Blazored.Menu/wwwroot/blazored-menu.css
@@ -54,13 +54,13 @@
padding-bottom: .75rem;
}
-.blazored-sub-menu {
- display: none;
- padding: 0;
- margin-left: 1rem;
- list-style: none;
-}
+ .blazored-sub-menu-header > .blazored-sub-menu {
+ display: none;
+ padding: 0;
+ margin-left: 1rem;
+ list-style: none;
+ }
-.blazored-sub-menu-header.open .blazored-sub-menu {
- display: block;
-}
+ .blazored-sub-menu-header.open > .blazored-sub-menu {
+ display: block;
+ }