How to Hide a Web Part in a Team Site (SharePoint 365)

Brian Curtis 91 Reputation points
2021-06-28T19:35:24.107+00:00

I'm looking for a control that will hide a web part, rather than deleting it. This is a common need in our page-design process, where we want to switch between layout ideas and show/hide different options we've come up with. We're just getting started with SP 365 and we don't have any advanced administrative functions analogous to SharePoint Designer (if they exist).

Microsoft 365 and Office | SharePoint Server | Development
0 comments No comments
{count} vote

Accepted answer
  1. CaseyYang-MSFT 10,461 Reputation points
    2021-06-29T08:13:36.54+00:00

    Hi @Brian Curtis ,

    Per my research, there is no available OOTB option to hide modern web parts in SharePoint Online. As a workaround, you could use Modern Script Editor Web Part with CSS code to hide the web part you want in modern page.

    1.First, you have to Add The Script Editor Webpart back to SharePoint Modern Experience.
    2.Please check CSS Style for the web part.
    3.Add display:none to this CSS Style in the Script Editor Web Part. Publish the page then the web part will be hidden.

    References:
    https://social.technet.microsoft.com/Forums/en-US/9aacc9e4-e8c1-4aeb-8527-3549630aeca1/hide-modern-web-part-code-snippet?forum=onlineservicessharepoint
    https://medium.com/niftit-sharepoint-blog/add-the-script-editor-webpart-back-to-sharepoint-modern-experience-688a7b7208e4
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.