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
+16-18Lines changed: 16 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -47,8 +47,8 @@ You can also follow these steps by watching this video on the SharePoint PnP You
47
47
* Accept the default **documentcardexample-webpart** as your solution name, and select Enter.
48
48
* Select **SharePoint Online only (latest)**, and select Enter.
49
49
* Select **Use the current folder** for where to place the files.
50
-
* Select **N** to require the extension to be installed on each site explicitly when it's being used.
51
-
- Select **N** on the question if solution contains unique permissions.
50
+
* Select **y** to require the extension to be installed on each site explicitly when it's being used.
51
+
- Select **N** on the question if solution contains unique permissions.cd
52
52
* Select **WebPart** as the client-side component type to be created.
53
53
54
54
5. The next set of prompts ask for specific information about your web part:
@@ -59,29 +59,21 @@ You can also follow these steps by watching this video on the SharePoint PnP You
59
59
60
60
At this point, Yeoman installs the required dependencies and scaffolds the solution files. This might take a few minutes. Yeoman scaffolds the project to include your DocumentCardExample web part as well.
61
61
62
-
6. When initial scaffolding is completed, you may need to explicitly add a version of office-ui-fabric-react to your package.json file. If you are using version 1.8.2 or later of the generator, you won't need to worry about this, but older versions will. Open your package.json file, and look for an entry for 'office-ui-fabric-react'. If there isn't one, add the following entry in your dependencies section
63
-
64
-
```
65
-
"office-ui-fabric-react": "5.132.0"
66
-
```
67
-
followed by the following command at your command prompt.
68
-
```
69
-
npm install
70
-
```
62
+
Starting from 1.8.2 version, Yeoman will automatically associate the recommended `@microsoft/sp-office-ui-fabric-core` package version to your solution when you select the **React** as the framework.
71
63
72
64
> [!NOTE]
73
-
> Starting with SharePoint Framework 1.8, you can use either Office UI Fabric version 5 or version 6. In this case we are using specifically Office UI Fabric version 5.132.0, so we are adding the needed dependency on it. If you would be using Office UI Fabric version 6.x, you'd also need to update the used TypeScript version of the solution. To use fabric 6, you need to be on at least rush-stack-compiler-2.9. The default project created with version 1.8.2 for SharePoint Online will use rush-stack-compiler-2.9 and fabric 6 (and won't need the step to add office-ui-fabric-react to your package.json file). Previous versions use either rush-stack-compiler 2.7 or a build system that is locked to typescript 2.4. In those cases, you'll need to reference fabric 5.132.0. If you are targeting on-prem, you will also want to use fabric 5.132.0.
65
+
> Starting with SharePoint Framework 1.8, you can use either Office UI Fabric version 5 or version 6. In this case we are using specifically Office UI Fabric version 5.132.0, so we are adding the needed dependency on it. If you would be using Office UI Fabric version 6.x, you'd also need to update the used TypeScript version of the solution. To use fabric 6, you need to be on at least rush-stack-compiler-2.9. The default project created with version 1.8.2 for SharePoint Online will use rush-stack-compiler-2.9 and fabric 6 (and won't need the step to add office-ui-fabric-react to your package.json file). Previous versions use either rush-stack-compiler 2.7 or a build system that is locked to typescript 2.4. In those cases, you'll need to reference fabric 5.132.0. If you are targeting on-prem, you will also want to use fabric 5.132.0.
74
66
75
67
76
-
7. Next, enter the following to open the web part project in Visual Studio Code:
68
+
6. Next, enter the following to open the web part project in Visual Studio Code:
77
69
78
70
```
79
71
code .
80
72
```
81
-
73
+
82
74
You now have a web part project with the React framework.
83
75
84
-
8. Open **DocumentCardExampleWebPart.ts** from the **src\webparts\documentCardExample** folder.
76
+
7. Open **DocumentCardExampleWebPart.ts** from the **src\webparts\documentCardExample** folder.
85
77
86
78
As you can see, the `render` method creates a react element and renders it in the web part DOM.
87
79
@@ -93,10 +85,13 @@ You can also follow these steps by watching this video on the SharePoint PnP You
93
85
description: this.properties.description
94
86
}
95
87
);
88
+
89
+
ReactDom.render(element, this.domElement);
90
+
}
96
91
```
97
-
98
-
9. Open **DocumentCardExample.tsx** from the **src\webparts\documentCardExample\components** folder.
99
-
92
+
93
+
8. Open **DocumentCardExample.tsx** from the **src\webparts\documentCardExample\components** folder.
94
+
100
95
This is the main react component that Yeoman added to your project that renders in the web part DOM.
101
96
102
97
```HTML
@@ -200,6 +195,9 @@ Copy the following images to your **src\webparts\documentCardExample\components*
0 commit comments