You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/spfx/web-parts/get-started/use-fabric-react-components.md
+80-43Lines changed: 80 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Use Office UI Fabric React components in your SharePoint client-side web part
2
2
3
-
####**Important:** You must upgrade existing projects to use @microsoft/sp-build-web@1.0.1 or later to use Office UI Fabric React. See instructions at the end of this article.
3
+
>**Important:** You must upgrade existing projects to use @microsoft/sp-build-web@1.0.1 or later to use Office UI Fabric React. Easiest way to achieve this is to ensure that you have latest package by running `npm install -g @microsoft/generator-sharepoint` in your console before completing this tutorial.
4
4
5
5
This article describes how to build a simple web part that uses the DocumentCard component of [Office UI Fabric React](https://github.com/OfficeDev/office-ui-fabric-react). Office UI Fabric React is the front-end framework for building experiences for Office and Office 365. Fabric React includes a robust collection of responsive, mobile-first components that make it easy for you to create web experiences using the Office Design Language.
6
6
@@ -40,10 +40,10 @@ yo @microsoft/sharepoint
40
40
When prompted:
41
41
42
42
* Accept the default **documentcardexample-webpart** as your solution name and choose **Enter**.
43
-
* Select **Use the current folder** as the ___location for the files.
44
-
* Select **React** as the framework and choose **Enter**.
43
+
* Select **WebPart** as the type of the client-side component and choose **Enter**
45
44
* Use **DocumentCardExample** for your web part name and choose **Enter**.
46
45
* Accept the default **DocumentCardExample description** and choose **Enter**.
46
+
* Select **React** as the framework and choose **Enter**.
47
47
48
48
At this point, Yeoman will install the required dependencies and scaffold the solution files. This might take a few minutes. Yeoman will scaffold the project to include your DocumentCardExample web part as well.
49
49
@@ -102,7 +102,7 @@ The *new modern experiences* in SharePoint use Office UI Fabric and Office UI Fa
102
102
103
103
Since we chose React as our framework when creating the solution, the generator installed the right version of Office UI Fabric React as well. You can directly import the Fabric components in your react components without any additional work.
104
104
105
-
>**Note:** With the initial release of the SharePoint Framework, it is recommended to use the Office UI Fabric and Fabric React that ships with the generator. It is not recommended to update the Office UI Fabric and Fabric React packages independently as it might conflict with the already available version in SharePoint and as a result your web part may fail to function as expected. There will be updates on this area after GA.
105
+
>**Note:** With the initial release of the SharePoint Framework, it is recommended to use the Office UI Fabric and Fabric React that ships with the generator. It is not recommended to update the Office UI Fabric and Fabric React packages independently as it might conflict with the already available version in SharePoint and as a result your web part may fail to function as expected.
106
106
107
107
Open **DocumentCardExample.tsx** from the **src\webparts\documentCardExample\components** folder.
108
108
@@ -121,34 +121,34 @@ import {
121
121
Delete the current `render` method and add the following updated `render` method:
Noticetheuseofrelativepathwitha`require`statementtoloadimages. Currently, you need to use the webpack public path plugin and input the file's relative path from your source file or folder to the `lib` folder. This should be the same as your current working source ___location.
163
+
Noticetheuseofrelativepathwitha`require`statementtoloadimages. Currently, you need to perform small configuration in the gulpfile.js to enable these images to get processed properly by webpack.
164
164
165
-
Open **DocumentCardExampleWebPart.ts** from the **src\webparts\documentCardExample** folder.
165
+
Open **gulpfile.js** from the **root** folder.
166
166
167
-
Add the following code at the top of the file to require the webpack public path plugin.
167
+
Add the following code just above the `build.initialize(gulp);` code line.
Inyourproject's `package.json`, update the `@microsoft/sp-build-web` dependency to at least version 1.0.1, delete your project's`node_modules`directory, andrun`npm install`.
0 commit comments