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:

  1. Navigate to the list or document library >> Click on the View dropdown and choose “Format current view” >> Click on “Advanced Mode”
  2. Paste the JSON below to hide the New button from the toolbar.hide button in list toolbar sharepoint online
{
  "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

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

21 thoughts on “Hide a Button in SharePoint Online List or document library Toolbar

  • I am looking to do the same kind of thing but not within the library itself. Instead when I show the list or library on a site page as a web part, there is that obnoxiously large “+new item”. How can I make it go away on site page only?

    Reply
  • So useful! Thanks! Your clear and succinct instructions, and well described problem statement (for googlability) made our unwanted “New” button into one of the shortest lived problems I’ve dealt with, in months and months.

    Reply
  • Hi, do you know if it’s possible to hide the “Send to approval” button?

    Reply
    • Yes to all of these – sorry for copy paste – just put the appropriate line in your CSS

      Hide right click context menu items – Replace “Details” with the text in the button to hide:
      li.ms-ContextualMenu-itemText[text~=Details] { display: none}

      Hide the Secondary command bar (views, i details button)
      .ms-OverflowSet.ms-CommandBar-secondaryCommand { display: none

      Hide main command bar button; replace “Edit in grid view” with the button text:
      button[name=”Edit in grid view”] {
      display: none;
      }

      Reply
  • Do you guys know of a way to hide the details pane (i) icon on top of a library / list
    This show all activities on a list or library I do not want everyone to see.

    Reply
    • Juse put the appropriate line in your CSS

      1. Hide right click context menu items – Replace “Details” with the text in the button to hide:
      >> li.ms-ContextualMenu-itemText[text~=Details] { display: none}

      2. Hide the Secondary command bar (views, i details button)
      >> .ms-OverflowSet.ms-CommandBar-secondaryCommand { display: none }

      Reply
  • Thanks. Really Helpful.

    Do you also know a way to hide the View Selecter?

    Reply
  • Thank you so much! This solves the ‘Sharepoint – hide sync button’ in an elegant easy way.

    Reply
  • 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.

    Reply
    • This can be done by editing the list view and clicking the button to hide it.

      Reply
  • 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

    Reply
  • Awesome, easiest solution in the internet

    Reply
  • Found the answer to my previous question here https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-commandbar-formatting

    Reply
  • Also would it be possible to use a similar method to hide the submenu item ‘Folder’ from the Upload menu?

    Reply
  • 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.

    Reply
  • 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?

    Reply
    • 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.

      Reply
  • This is amazing! Thanks for sharing!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *