Skip to content

Commit f05946d

Browse files
author
Ben Szymanski
committed
Revised icons documentation for clarity, updated examples, and removed outdated content.
1 parent f319b80 commit f05946d

File tree

1 file changed

+21
-31
lines changed
  • 16/umbraco-cms/customizing/extending-overview/extension-types

1 file changed

+21
-31
lines changed

16/umbraco-cms/customizing/extending-overview/extension-types/icons.md

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,37 @@
11
---
2-
description: Learn how to append and use Icons.
2+
description: Create custom icon sets for use across the Umbraco backoffice.
33
---
44

55
# Icons
66

7-
This article describes how to add and use more icons in your UI.
8-
9-
{% hint style="warning" %}
10-
This page is a work in progress and may undergo further revisions, updates, or amendments. The information contained herein is subject to change without notice.
11-
{% endhint %}
7+
Umbraco extension authors can create custom icon sets for use across the Umbraco backoffice using an extension type called `icons`.
128

139
## Register a new set of icons
1410

15-
New icons can be added via an extension type called `icons`.
16-
17-
You must add a new manifest to the Extension API to register icons. The manifest can be added through the `umbraco-package.json` file as shown in the snippet below.
11+
Icons must be registered in a manifest using the Extension API. The manifest can be added through the `umbraco-package.json` file, as shown below.
1812

1913
{% code title="umbraco-package.json" %}
20-
2114
```json
2215
{
23-
"name": "MyPackage",
24-
"extensions": [
25-
{
26-
"type": "icons",
27-
"alias": "MyPackage.Icons.Unicorn",
28-
"name": "MyPackage Unicorn Icons",
29-
"js": "/App_Plugins/MyPackage/Icons/icons.js"
30-
}
31-
]
16+
"$schema": "../../umbraco-package-schema.json",
17+
"name": "My Package",
18+
"version": "0.1.0",
19+
"extensions": [
20+
{
21+
"type": "icons",
22+
"alias": "MyPackage.Icons.Unicorn",
23+
"name": "MyPackage Unicorn Icons",
24+
"js": "/App_Plugins/MyPackage/Icons/icons.js"
25+
}
26+
]
3227
}
3328
```
34-
3529
{% endcode %}
3630

37-
The file set in the `js` field holds the details about your Icons. The file should resemble the following:
31+
The file set in the `js` field contains the details of your icons. These definitions should resemble the following:
3832

3933
{% code title="icons.js" %}
40-
41-
```typescript
34+
```javascript
4235
export default [
4336
{
4437
name: "myPackage-unicorn",
@@ -50,26 +43,23 @@ export default [
5043
}
5144
]
5245
```
53-
5446
{% endcode %}
5547

56-
The icon name needs to be prefixed to avoid collision with other icons.
48+
Prefix each icon name to avoid collisions with other icons.
5749

58-
Each icon must define a path, either as a string or a dynamic import as shown above. This file must be a JavaScript file containing a default export of an SVG string. See an example of this in the code snippet below.
50+
Each icon must define a path, either as a string or a dynamic import as shown above. This file must be a JavaScript file containing a default export of an SVG string. See an example below:
5951

6052
{% code title="icon-unicorn.js" %}
61-
62-
```typescript
53+
```javascript
6354
export default `<svg ...></svg>`;
6455
```
65-
6656
{% endcode %}
6757

6858
### Using Icons in your UI
6959

70-
The `umb-icon` element is automatically able to consume any registered icon.
60+
The `umb-icon` element can automatically consume any registered icon.
7161

72-
The following example shows how to make a button using the above-registered icon.
62+
The following example demonstrates how to create a button using the registered icon.
7363

7464
```html
7565
<uui-button compact label="Make the unicorn dance">

0 commit comments

Comments
 (0)