Hide a Button in SharePoint Online List or document library Toolbar
Requirement: Hide a Button (E.g. New, Upload, Share, etc.) in SharePoint Online.
How to hide the “New” button in SharePoint Online List View?
Have you ever wanted to hide a button from the SharePoint Online list or document library? E.g. You may want to hide the new button in the SharePoint Online list view. In this post, we’ll show you how to do it using some simple list view formatting. With just a few lines of JSON code, you can easily hide any button on your SharePoint Online list.
Do the following to hide a button from the SharePoint Online list view using list view formatting:
- Navigate to the list or document library >> Click on the View dropdown and choose “Format current view” >> Click on “Advanced Mode”
- Paste the JSON below to hide the New button from the toolbar.
{
"commandBarProps" : {
"commands": [
{
"key": "new",
"hide": true
}
]
}
}
Here is the result:
The command bar customization method can be used not only for hiding a button but also to rename the button text, replace the icon, change the order of the buttons, etc. More here: https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-commandbar-formatting
Hello, is there a way to hide the “All items” button from the tool bar? This works perfect for the “New” button, I was just wondering if we can change that.
This can be done by editing the list view and clicking the button to hide it.
Hi,
is there a way to customize the “New” section?
I would like certain user groups to be able to just create a new page. Everything else should be hidden from the menu (news post, document etc.)
thanks for your reply,
Marcel
Awesome, easiest solution in the internet
Found the answer to my previous question here https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-commandbar-formatting
Also would it be possible to use a similar method to hide the submenu item ‘Folder’ from the Upload menu?
Hi – this is a fantastic tip. You will need to do this to each view on the list if the requirement is to not have New seen at all. I wish there was a SharePoint List setting to do this override.
One thing to improve instruction above is include the missing dot point after Format Current View “Click Advanced mode”
Thank you for this incredible site. I have had countless benefits from all the Powershell samples.
Thanks, Mark! Added it.
This is super helpful. I’m trying to hide the button to open the details pane, but I don’t think there is a key reference for that button. Do you know if this is possible at all?
You can turn off “Quick property editing” from the List settings >> Advanced settings to make the details pane read-only. Hiding the button using CSS is also possible.
This is amazing! Thanks for sharing!