Navigation
Universal Dashboard is now a part of PowerShell Universal. This documentation is for reference to the v2 version of Universal Dashboard and is no longer maintained.
PowerShell Universal Documentation can be found here.

Navigation

Requires Universal Dashboard 2.3 or later
By default, when new Pages are added to a dashboard, a navigation menu will be created that provides access to all the static pages. Dynamic pages will not show up in the navigation menu.

Customizing Navigation

To customize navigation, you can use the New-UDSideNav and New-UDSideNavItem cmdlets for full control over the navigation pane. In the simplest form, you can add items to the side navigation and the provide the side nav to the dashboard.
1
$Page1 = New-UDPage -Name "Page Name" -Content { New-UDCard -Id 'page-1' }
2
$Page2 = New-UDPage -Name "Page Name 2" -Content { New-UDCard -Id 'page-2'}
3
4
$Navigation = New-UDSideNav -Content {
5
New-UDSideNavItem -Text "My First Page" -PageName "Page Name" -Icon group
6
New-UDSideNavItem -Text "My Second Page" -PageName "Page Name 2" -Icon User
7
New-UDSideNavItem -Text "Google" -Url 'https://www.google.com' -Icon Users
8
}
9
10
$Dashboard = New-UDDashboard -Title "Navigation" -Pages @($Page1, $Page2) -Navigation $Navigation
Copied!

Hiding the Side Navigation and Hamburger Menu Button

You can hide the side navigation completely by using the -None parameter of New-UDSideNav .
1
$Page1 = New-UDPage -Name "Page Name" -Content { New-UDCard -Id 'page-1' }
2
$Page2 = New-UDPage -Name "Page Name 2" -Content { New-UDCard -Id 'page-2'}
3
4
$Navigation = New-UDSideNav -None
5
6
New-UDDashboard -Title "Navigation" -Pages @($Page1, $Page2) -Navigation $Navigation
Copied!

Creating Nested Menu Structures

To create nested menu structures in the side navigation menu, use the -Children parameter of New-UDSideNavItem to provide the child nodes for the menu.
1
$Page1 = New-UDPage -Name "Page Name" -Content { New-UDCard -Id 'page-1' }
2
$Page2 = New-UDPage -Name "Page Name 2" -Content { New-UDCard -Id 'page-2'}
3
4
$Navigation = New-UDSideNav -Content {
5
New-UDSideNavItem -Text "Section" -Children {
6
New-UDSideNavItem -Text "My Second Page" -PageName "Page Name 2" -Icon User
7
New-UDSideNavItem -Text "Google" -Url 'https://www.google.com' -Icon Users
8
}
9
} -Fixed
10
11
New-UDDashboard -Title "Navigation" -Pages @($Page1, $Page2) -Navigation $Navigation
Copied!

Including Dividers and Subheaders

Menus can include dividers and subheaders. Both of these items can be created using the New-UDSideNavItem cmdlet.
1
$Page1 = New-UDPage -Name "Page Name" -Content { New-UDCard -Id 'page-1' }
2
$Page2 = New-UDPage -Name "Page Name 2" -Content { New-UDCard -Id 'page-2'}
3
4
$Navigation = New-UDSideNav -Content {
5
New-UDSideNavItem -Text "My First Page" -PageName "Page Name" -Icon group
6
New-UDSideNavItem -Subheader -Text "Subheader"
7
New-UDSideNavItem -Text "My Second Page" -PageName "Page Name 2" -Icon User
8
New-UDSideNavItem -Divider
9
New-UDSideNavItem -Text "Google" -Url 'https://www.google.com' -Icon Users
10
} -Fixed
11
12
New-UDDashboard -Title "Navigation" -Pages @($Page1, $Page2) -Navigation $Navigation
Copied!

Dynamically Building Menus

Menus can be built dynamically by providing an endpoint script block to New-UDSideNav . This script block will be called the first time a user loads the dashboard and on page refreshes.
1
$Page1 = New-UDPage -Name "Page Name" -Content { New-UDCard -Id 'page-1' }
2
$Page2 = New-UDPage -Name "Page Name 2" -Content { New-UDCard -Id 'page-2'}
3
4
$Navigation = New-UDSideNav -Endpoint {
5
New-UDSideNavItem -Text "My First Page" -OnClick { Show-UDModal -Content { New-UDCard -Id "ModalCard" } } -Icon group
6
} -Fixed
7
8
New-UDDashboard -Title "Navigation" -Pages @($Page1, $Page2) -Navigation $Navigation
Copied!
Last modified 3mo ago