RoverCore Navigation is a Razor Class Library that provides a service to load navigation menus from appsettings.json. Menu items are filtered automatically by role to reduce the menu to only the options the user has permission for.
services.AddScoped<NavigationService>();When you want the menu to appear simply include the following code in one of your razor pages.
@(await Component.InvokeAsync<NavbarViewComponent>())Create a folder at Views/Shared/Components/Navbar in your primary Asp.net web project and copy over the Default.cshtml from this project to that directory. Any customizations you make to Default.cshtml will be reflected on your website.
{
"Navigation": [
{
"NavMenuItems": [
{
"Text": "Home",
"Type": "link",
"Controller": "Home",
"Action": "Index",
"Values": {
"Area": "Dashboard"
},
"Icon": "las la-home",
"Roles": [ "User", "Admin" ]
},
{
"Text": "Dropdown",
"Type": "dropdown",
"Controller": "Home",
"Action": "Index",
"Values": {
"Area": "Dashboard"
},
"Icon": "las la-dumpster",
"Roles": [ "User", "Admin" ],
"Children": [
{
"Text": "Dropdown 1",
"Type": "link",
"Controller": "Home",
"Action": "Index",
"Values": {
"Area": "Dashboard"
},
"Icon": "ti-home",
"Roles": [ "User", "Admin" ]
},
{
"Text": "Dropdown 2",
"Type": "dropdown",
"Icon": "ti-home",
"Roles": [ "User", "Admin" ],
"Children": [
{
"Text": "Dropdown 3",
"Type": "link",
"Controller": "Home",
"Action": "Index",
"Values": {
"Area": "Dashboard"
},
"Icon": "ti-home",
"Roles": [ "User", "Admin" ]
},
{
"Text": "Dropdown 4",
"Type": "dropdown",
"Icon": "ti-home",
"Roles": [ "User", "Admin" ],
"Children": [
{
"Text": "Dropdown 5",
"Type": "link",
"Controller": "Home",
"Action": "Index",
"Values": {
"Area": "Dashboard"
},
"Icon": "ti-home",
"Roles": [ "User", "Admin" ]
},
{
"Text": "Dropdown 6",
"Type": "link",
"Icon": "ti-home",
"Roles": [ "User", "Admin" ]
}
]
}
]
}
]
},
{
"Text": "Documentation",
"Type": "link",
"Url": "https://rovercore.github.io/RoverCoreDocs/docs/",
"Icon": "las la-file-alt",
"Roles": [ "User", "Admin" ]
}
]
}
]
}