If you've tried to disable the top navigation bar on a modern Teams-connected SharePoint site, you've probably noticed there's no obvious setting to do it. The UI doesn't give you a toggle. Site settings don't have the option. And the PowerShell properties you'd expect to work simply don't.
This post covers exactly that scenario - what I tried, why each approach failed, and the single PnP PowerShell command that actually works.
The Problem
On a modern Teams-connected SharePoint site (template GROUP#0), the top navigation bar is visible by default. Unlike classic SharePoint publishing sites, there is no built-in UI option in site settings or site collection settings to disable it. If you want to hide the top navigation bar - for example because the site is associated to a hub that already provides navigation, making the site's own top nav redundant - you need to do it programmatically.
What Didn't Work for Me
1. Site Settings and Site Collection Settings
The first place anyone looks. On modern Teams-connected SharePoint sites there is no toggle to disable the top navigation bar in either site settings or site collection settings. Classic publishing sites had this option under Navigation Elements; modern sites simply don't expose it in the UI.
2. Change the Look → Navigation
Settings gear → Change the look → Navigation provides some visibility options on certain modern sites. On Teams-connected sites this either doesn't appear or only controls the left navigation, not the top navigation bar.
3. QuickLaunchEnabled
A commonly referenced property for hiding navigation:
$web = Get-PnPWeb -Includes QuickLaunchEnabled -Connection $conn
Write-Host "QuickLaunchEnabled: $($web.QuickLaunchEnabled)"
This controls the left navigation panel (Quick Launch), not the top navigation bar. Setting it to $false has no effect on the top nav. Not the right property.
4. IsVisible on TopNavigationBar Nodes
Enumerating the TopNavigationBar navigation nodes and setting IsVisible = $false on each:
$nodes = Get-PnPNavigationNode -Location TopNavigationBar -Connection $conn
foreach ($node in $nodes) {
$node.IsVisible = $false
$node.Update()
}
Invoke-PnPQuery -Connection $conn
This appears to work - reading $node.IsVisible back returns False - but the navigation remains fully visible in the browser. Modern SharePoint's rendering engine does not honour this classic CSOM property. It reads from a different configuration layer entirely.
5. Navigation.UseShared
The idea here is to make the site inherit navigation from a parent or hub, which would suppress its own top nav. This hits two walls:
$web = Get-PnPWeb -Includes Navigation -Connection $conn
$web.Navigation.UseShared = $true # throws error on root web
$web.Navigation.Update() # method does not exist
Setting UseShared = $true on a root web throws: "A root web site cannot use shared navigation from another web site." And Navigation.Update() doesn't exist as a method on the Navigation object anyway - another dead end.
What Actually Works
The correct lever for modern SharePoint Online is the header layout. Setting it to Minimal hides the top navigation bar entirely while leaving all navigation nodes intact - nothing is deleted, so it can be re-enabled at any time:
$conn = Connect-PnPOnline -Url "https://<tenant>.sharepoint.com/sites/<teamsite>" `
-ClientId $clientId -Tenant $tenantId `
-Thumbprint $thumbprint -ReturnConnection
Set-PnPWebHeader -HeaderLayout Minimal -Connection $conn
To re-enable the top navigation later:
Set-PnPWebHeader -HeaderLayout Standard -Connection $conn
All four HeaderLayout values and their effect on the top navigation:
| HeaderLayout | Top Navigation |
|---|---|
Standard |
Visible (default) |
Compact |
Visible, smaller header |
Minimal |
Hidden |
Extended |
Visible, large header with background image support |
Why the Other Approaches Failed
The classic CSOM properties - IsVisible, UseShared, QuickLaunchEnabled - predate modern SharePoint's rendering pipeline. They are still readable and writable via the API, but the modern header component doesn't consult them. It reads header configuration from a separate modern layer. Set-PnPWebHeader targets that modern layer directly, which is why it is the only approach that actually works.
This is a recurring pattern in SharePoint Online administration: properties that worked in classic SharePoint are still present in the API but silently ignored by modern rendering. Always check whether a more recent cmdlet exists before assuming a classic CSOM property is the right tool.
Key Takeaway
To hide the top navigation bar on a modern Teams-connected SharePoint Online site, use:
Set-PnPWebHeader -HeaderLayout Minimal -Connection $conn
Classic CSOM navigation properties (IsVisible, UseShared, QuickLaunchEnabled) are ignored by the modern rendering engine. Set-PnPWebHeader is the correct cmdlet for modern SharePoint header and navigation control.
Frequently Asked Questions
Can I hide the top navigation bar on a SharePoint Online modern site without PowerShell?
Not reliably on a Teams-connected site. The UI does not expose a toggle for the top navigation bar on modern GROUP#0 sites. The only supported method is via PnP PowerShell using Set-PnPWebHeader -HeaderLayout Minimal.
Does Set-PnPWebHeader -HeaderLayout Minimal delete my navigation nodes?
No. Setting the header layout to Minimal hides the navigation bar visually but leaves all navigation nodes intact. You can restore them at any time by running Set-PnPWebHeader -HeaderLayout Standard.
Why does IsVisible = $false not work on SharePoint navigation nodes?
The IsVisible property is a classic CSOM property that predates modern SharePoint's rendering pipeline. The modern header component does not read this property - it uses a separate configuration layer. Use Set-PnPWebHeader instead.
Why does Navigation.UseShared not work on a Teams-connected site?
Setting $web.Navigation.UseShared = $true throws an error on root web sites: "A root web site cannot use shared navigation from another web site." Additionally, Navigation.Update() does not exist as a method on the Navigation object in modern PnP PowerShell versions.
Does this work on communication sites as well as team sites?
Yes. Set-PnPWebHeader -HeaderLayout Minimal works on any modern SharePoint Online site regardless of template, including communication sites (SITEPAGEPUBLISHING#0) and Teams-connected team sites (GROUP#0).
Can I apply this to multiple sites at once?
Yes. Use Get-PnPTenantSite to retrieve all sites of a given template and loop through them applying Set-PnPWebHeader -HeaderLayout Minimal to each.
Further Reading
- Set-PnPWebHeader - PnP PowerShell docs - full parameter reference including all HeaderLayout accepted values
- Customize your site header using PnP - broader overview of header customisation options via PnP PowerShell
- Hiding redundant top nav in SPO - Tech Community - community thread asking the same question, never properly answered
- Customize the navigation on your SharePoint site - Microsoft Support - official Microsoft docs on SharePoint navigation options
Comments