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/basics/configure-web-part-icon.md
+66-9Lines changed: 66 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -8,23 +8,31 @@ localization_priority: Priority
8
8
9
9
# Configure web part icon
10
10
11
-
Selecting an icon that illustrates the purpose of your SharePoint client-side web part makes it easier for users to find your web part among other all web parts available in the toolbox.
11
+
Selecting an icon that illustrates the purpose of your SharePoint client-side web part makes it easier for users to find your web part among all other web parts available in the toolbox or when creating [single part app pages](../single-part-app-pages.md).
12
12
13
13
## Preconfigure web parts
14
14
15
15
A web part icon is defined in the web part manifest as part of preconfigured entries. If you have a multipurpose web part that can be configured to meet different needs, each configuration can have a different icon indicating its purpose.
16
16
17
17
Using a representative icon helps users find the web part they're looking for. For more information about preconfiguring your web parts, see [Simplify adding web parts with preconfigured entries](../guidance/simplify-adding-web-parts-with-preconfigured-entries.md).
18
18
19
-
SharePoint Framework offers you a number of ways to define the icon for your web part.
19
+
In the web part manifest you can configure the web part icon displayed in the toolbox and a preview image displayed when creating single part app pages.
20
20
21
-
## Use Fluent UI icon font
21
+
## Specify toolbox icon
22
+
23
+
Toolbox icon is displayed when in the web part toolbox, when users choose to add a web part to the page.
24
+
25
+

26
+
27
+
SharePoint Framework offers you a number of ways to define the toolbox icon for your web part.
28
+
29
+
### Use Fluent UI icon font
22
30
23
31
One way to define the icon for your web part is by using the `officeFabricIconFontName` property. This property allows you to choose one of the icons offered as a part of Fluent UI.
24
32
25
33
For a list of available Fluent UI icons, see [Icons](https://developer.microsoft.com/fluentui#/styles/web/icons).
26
34
27
-
### To use a specific icon
35
+
####To use a specific icon
28
36
29
37
1. On the Fluent UI icons overview page, copy its name, and paste it as the value of the `officeFabricIconFontName` property in the manifest of your web part.
30
38
@@ -68,13 +76,13 @@ For a list of available Fluent UI icons, see [Icons](https://developer.microsoft
68
76
69
77
The benefit of this approach is that you don't need to deploy the icon image file along with your web part assets. Additionally, on computers using different DPI or other accessibility settings, the icon automatically adapts to these settings without losing quality.
70
78
71
-
## Use an external icon image
79
+
### Use an external icon image
72
80
73
81
Although Fluent UI offers many images, when building web parts you might want to use something specific to your organization to clearly separate your web parts from other first and third-party web parts visible in the toolbox.
74
82
75
83
In addition to using Fluent UI icons, the SharePoint Framework also allows you to use images.
76
84
77
-
### To use an image as a web part icon
85
+
#### To use an image as a web part icon
78
86
79
87
1. Specify the image's absolute URL in the `iconImageUrl` property in the web part manifest.
80
88
@@ -116,13 +124,13 @@ In addition to using Fluent UI icons, the SharePoint Framework also allows you t
116
124
117
125
While using custom images gives you more flexibility to choose an icon for your web part, it requires you to deploy them along with your other web part assets. Additionally, your image might lose quality when displayed in higher DPI or specific accessibility settings. To avoid quality loss, you can use vector-based SVG images, which are also supported by the SharePoint Framework.
118
126
119
-
## Use a base64-encoded image
127
+
### Use a base64-encoded image
120
128
121
129
When using a custom image, rather than specifying an absolute URL to the image file hosted together with other web part assets, you can have your image base64-encoded and use the base64 string instead of the URL.
122
130
123
131
A number of services are available online that you can use to base64-encode your image; for more information, see [Convert your images to Base64](https://www.base64-image.de).
124
132
125
-
### To use a base64-encoded image
133
+
#### To use a base64-encoded image
126
134
127
135
1. Encode the image.
128
136
1. Copy the base64 string and use it as the value for the `iconImageUrl` property in the web part manifest.
@@ -163,8 +171,57 @@ Base64 encoding works for both bitmap images, such as PNG, and vector SVG images
163
171
164
172

165
173
166
-
## Additional considerations
174
+
### Additional considerations
167
175
168
176
Each web part must have an icon. If you specify the web part icon by using both the `officeFabricIconFontName` and the `iconImageUrl` properties, the icon specified in the `officeFabricIconFontName` is used.
169
177
170
178
If you choose not to use a Fluent UI icon, you have to specify a URL in the `iconImageUrl` property.
179
+
180
+
## Set the single part app page preview image
181
+
182
+
Starting from SharePoint Framework v1.11 you can specify the preview image for your web part that's displayed when users create a single part app page.
183
+
184
+

185
+
186
+
> [!CAUTION]
187
+
> At this moment, the single part app page image can be set only to an image URL. Using base64-encoded images is currently not supported.
188
+
189
+
### To set the single part app page preview image
190
+
191
+
Specify the image's absolute URL in the `fullPageAppIconImageUrl` property in the web part manifest.
> When displayed in the browser, the image will adjust its size based on the current screen size. By default, the image dimensions are 193x158px, where the bottom 48px are partially covered by the label with the web part's name. On smaller screens, the size and dimension of the displayed image will vary and the label with the web part's name can cover a relatively larger portion of the image.
0 commit comments