|
| 1 | +--- |
| 2 | +title: Hide a web part from the toolbox |
| 3 | +description: How to hide a web part from showing up in the web part toolbox on a modern page |
| 4 | +ms.date: 05/23/2018 |
| 5 | +ms.prod: sharepoint |
| 6 | +--- |
| 7 | + |
| 8 | +# Hide a web parts from the toolbox |
| 9 | + |
| 10 | +For scenarios where you automatically instantiate a custom web part on a modern page, you might want the web part not to be manually available for end-users. This could for example be a status web part on a home page. |
| 11 | + |
| 12 | +## Configure hiding the web part from the toolbox |
| 13 | + |
| 14 | +By default a SharePoint Framework client-side web part will be displayed in the web part toolbox when a user edit a page. To allow hiding the web part from the toolbox you add set the `hiddenFromToolbox` property to `true` in the web part manifest. |
| 15 | + |
| 16 | +```json |
| 17 | +{ |
| 18 | + "$schema": "https://dev.office.com/json-schemas/spfx/client-side-web-part-manifest.schema.json", |
| 19 | + "id": "34f6d7f2-262f-460a-8b65-152d784127cb", |
| 20 | + "alias": "HelloWorldWebPart", |
| 21 | + "componentType": "WebPart", |
| 22 | + |
| 23 | + // The "*" signifies that the version should be taken from the package.json |
| 24 | + "version": "*", |
| 25 | + "manifestVersion": 2, |
| 26 | + |
| 27 | + // If true, the component can only be installed on sites where Custom Script is allowed. |
| 28 | + // Components that allow authors to embed arbitrary script code should set this to true. |
| 29 | + // https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f |
| 30 | + "requiresCustomScript": false, |
| 31 | + "hiddenFromToolbox": true, |
| 32 | + |
| 33 | + "preconfiguredEntries": [{ |
| 34 | + "groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other |
| 35 | + "group": { "default": "Other" }, |
| 36 | + "title": { "default": "HelloWorld" }, |
| 37 | + "description": { "default": "HelloWorld description" }, |
| 38 | + "officeFabricIconFontName": "Page", |
| 39 | + "properties": { |
| 40 | + "description": "HelloWorld" |
| 41 | + } |
| 42 | + }] |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +With the `hiddenFromToolbox` setting enabled, when you edit a page, the web part will not be listed in the toolbox. |
0 commit comments