Skip to content

Commit 2a70f4c

Browse files
authored
Merge pull request #13 from magento-devdocs/MAGEDOC-3424
MAGEDOC-3424: Update Iconography topic
2 parents 39cf484 + e8bebd0 commit 2a70f4c

5 files changed

+114
-14
lines changed

docs/configurations/iconography.md

+114-14
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,132 @@
22

33
## Overview
44

5-
PageBuilder Admin icons follow the same design principles as the core [Magento Admin icons].
6-
They are simple, flat, and monochromatic to prevent the loss of detail at smaller sizes and makes the shapes easier to comprehend.
5+
PageBuilder Admin icons follow the same design principles as the core [Magento Admin icons]. They are simple, flat, and monochromatic to prevent the loss of detail at smaller sizes, while making their shapes easier to comprehend.
76

87
## Page Builder icons
98

10-
The following image shows all available PageBuilder Admin icons with class names to reference them by:
9+
Here are the available PageBuilder Admin font icons (with class names) for use within your content type as needed:
1110

1211
![PageBuilder admin icons](../images/pagebuilder-icons.png){:width="870px" height="auto"}
1312

14-
You can use these icons when extending or customizing the PageBuilder module or [create your own icons].
13+
Page Builder references these icons by their class names. For example, Page Builder's Heading content type references `icon-pagebuilder-heading` for its panel icon configuration file, as shown here:
1514

16-
## Creating icon fonts
15+
```xml
16+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_PageBuilder:etc/content_type.xsd">
17+
<type name="heading"
18+
label="Heading"
19+
icon="icon-pagebuilder-heading"
20+
...>
21+
```
1722

18-
We recommend using icon fonts to get the best quality for your icons.
19-
The PageBuilder Admin icon fonts can be found in the [cms-icons repository].
23+
Page Builder's Heading also references three more icons in its toolbar as defined in `Magento/PageBuilder/view/adminhtml/web/js/content-type/heading/preview.js`, shown here:
2024

21-
If you want to add your own icons, each icon will need to be in its own SVG files. There are multiple ways to create icon fonts, here is one to get started:
25+
```js
26+
{
27+
key: "text_align",
28+
type: "select",
29+
values: [{
30+
value: "left",
31+
label: "Left",
32+
icon: "icon-pagebuilder-align-left"
33+
}, {
34+
value: "center",
35+
label: "Center",
36+
icon: "icon-pagebuilder-align-center"
37+
}, {
38+
value: "right",
39+
label: "Right",
40+
icon: "icon-pagebuilder-align-right"
41+
}]
42+
}];
43+
```
2244

23-
1. Go to <a href="https://icomoon.io/app/" target="\_blank"> https://icomoon.io/app/ </a> or download this app in Chrome web store.
45+
The icons render in the Heading's toolbar, as shown here:
2446

25-
2. Upload your icons in SVG format into the app.
47+
![Create config file](../images/iconography-toolbar-icons.png)
48+
49+
You can use these icon class names in your own content types or create your own icons using SVG files (recommended) or PNGs, as described next.
50+
51+
## Creating SVG or PNG icons
52+
53+
To add your own icons, we recommend creating SVG images because they are smaller and render more clearly on high-resolution screens, including mobile devices.
54+
55+
The size, appearance, and color of your images depend on where within Page Builder you want to use them. You can add icons to Page Builder in three areas:
56+
57+
- Panel
58+
- Form
59+
- Stage
60+
61+
### Panel icons
62+
63+
To create a panel icon that integrates seamlessly with the existing panel icons, use the following specifications:
64+
65+
![Create config file](../images/step6-icon-properties.png)
66+
67+
The *artboard* represents the actual width and height of your icon when it is exported from your graphics application (16 x 16px). The *artwork* represents the content of your icon. Following these dimensions to ensure your icons match the size and positioning of the existing Page Builder font icons within the panel.
68+
69+
### Form icons
70+
71+
Most of the images used in the Page Builder base forms are one of three sizes: 20 x 20px, 148 x 60px, and 194 x 98px.
72+
73+
![Create config file](../images/iconography-form-icons.png)
74+
75+
Your images should match Page Builder's images in both size and appearance. This ensures a professional, integrated look alongside Page Builder's existing icons. We recommend creating three artboards to match these three sizes. Then give your artwork 1-2 pixels of white space from the artboard's edge, as described for panel icons.
76+
77+
### Stage icons
78+
79+
Stage images can be a variety of sizes. For example, Page Builder's `cms-empty-row.svg` image (shown for an empty row, no doubt) is 468 x 103px with a color of #AAA6A0, as shown here:
80+
81+
![Create config file](../images/iconography-stage-images.png)
82+
83+
Again, take note of its simple design and subtle color.
84+
85+
## Adding your images
86+
87+
Add all your SVG and/or PNG icons to the `adminhtml/web/css/images` directory for your content type. For example, if your content type is called `example-quote`, you would put your icons in `adminhtml/web/css/images/content-type/example-quote/appearance/`, as follows:
88+
89+
![Create config file](../images/iconography-adding-icons.png)
90+
91+
## Create CSS classes
92+
93+
As discussed earlier in this topic, Page Builder references its icon fonts using class names from a variety of locations, such as the panel, the toolbar, and the visual selectors within forms. To participate in this icon system, you need to create a CSS class for each SVG and/or PNG image you want to reference by class name.
94+
95+
Add the CSS classes for your icons to your LESS file in `adminhtml` (and to the `frontend` LESS file if relevant), as shown here:
96+
97+
![Create config file](../images/step6-icon-style.png)
98+
99+
The following CSS rule set shows one general way to link your icons through CSS:
100+
101+
```css
102+
.icon-pagebuilder-quote {
103+
background-image: url('@{baseDir}Example_PageBuilderQuote/css/images/content-type/example-quote/appearance/icon-pagebuilder-quote.svg');
104+
width: 16px;
105+
height: 16px;
106+
}
107+
```
108+
109+
If you are creating an icon for the panel, replace the `background-image` attribute with `content` (as described in the content type tutorial, [Step 6: Add an icon](../create-basic-content-type/step-6-add-icon.md)).
110+
111+
| Attribute | Description |
112+
| ---------------------- | ------------------------------------------------------------ |
113+
| `class name` | To match the class names of Page Builder's native icons, we recommend prefixing your icon names with `icon-pagebuilder`, as we have done with the Quote panel icon. |
114+
| `background-image url` | The `url` used for the `background-image` is the most critical part of your own CSS classes. Always use the `@{baseDir}` variable followed by your full module name, followed by the path to your image, starting with `css`. When deployed, Page Builder creates a link in the static output where the browser can resolve it, as described below. |
115+
| `width` | Sets the width of the icon image. |
116+
| `height` | Sets the height of the icon image. |
117+
118+
When deployed, your CSS classes and links to your icons are generated in `pub/static`, as shown here:
119+
120+
![Create config file](../images/step6-icon-link-static.png)
121+
122+
For more general information about Magento's Admin icons and how to create your own icons for use in Magento, take a look at these topics:
123+
124+
* [Magento Admin icons]
125+
* [Create your own icons]
126+
* [The CMS icons repository]
26127

27-
3. Specify desired font names and specify the Unicode characters to map the icons. Setting the icons to Private User Area will disable screen-readers or other accessibility tools to read your icon's characters (read "Unicode" section here).
28128

29-
4. Then initialize a download in the app to generate the icon font and CSS style sheet.
30129

31130
[Magento Admin icons]: https://devdocs.magento.com/guides/v2.2/pattern-library/graphics/iconography/iconography.html
32-
[create your own icons]: https://devdocs.magento.com/guides/v2.2/pattern-library/graphics/iconography/iconography.html#creating-icons
33-
[cms-icons repository]: https://github.com/magento-ux/cms-icons
131+
[Create your own icons]: https://devdocs.magento.com/guides/v2.2/pattern-library/graphics/iconography/iconography.html#creating-icons
132+
[The CMS icons repository]: https://github.com/magento-ux/cms-icons
133+
26.9 KB
Loading
21.4 KB
Loading
10.6 KB
Loading
7.91 KB
Loading

0 commit comments

Comments
 (0)