|
1 | 1 | # Creating icons |
2 | 2 |
|
3 | | -EUI provides an ever-growing set of [icons][icons], but our set can be incomplete. If you find you need an icon that does not exist, create a new issue and tag it with the *icons* label. A designer from the EUI team will respond to discuss your needs. |
| 3 | +EUI provides an ever-growing set of [icons][icons], but our set can be incomplete. If you find you need an icon that does not exist, create a new [icon request](https://github.com/elastic/eui/issues/new?template=06-icon-request.md) issue. A designer from the EUI team will respond to discuss your needs. |
4 | 4 |
|
5 | | -If you are willing and able to design the icon yourself, this document describes the guidelines for designing a new icon, cleaning up the SVG, and getting it added to EUI. While designers on the EUI team are available to assist, we greatly appreciate your contributions and pull requests. |
| 5 | +If you are willing and able to design the icon yourself, this document describes the [design guidelines](#design-guidelines), cleaning up the SVG, and getting it added to EUI. While designers on the EUI team are available to assist, we greatly appreciate your contributions and pull requests. |
6 | 6 |
|
7 | 7 | If you read through these guidelines or begin designing your icon and realize you're in too deep, then create an issue in this repo and request assistance. An EUI team member will reply and discuss options. |
8 | 8 |
|
9 | 9 | _**Note on 3rd-party / custom SVGs**_ |
10 | 10 | - The `EuiIcon` component accepts external references to custom SVG files, so you can maintain the icon in your consuming application. |
11 | 11 | - This practice should also be used for any **3rd-party logos**. For a number of reasons, the EUI team as moved away from maintaining a set of 3rd party logos. Please use the custom SVG option going forward. |
12 | 12 |
|
13 | | -## Design the icon |
14 | | - |
15 | | -From a content perspective, we've taken an approach of being open to many types of icons so long as they don't duplicate an icon that already exists. Stylistically, we have more stringent requirements outlined below. |
16 | | - |
17 | | -### Content |
| 13 | +## Content |
18 | 14 |
|
19 | 15 | While we're pretty much open to all requests, we ask that you first try to use an existing icon as this helps us avoid having multiple versions of the same glyph. Likewise, if there is a universally known icon that represents an action, we recommend leveraging those existing patterns (e.g. a scissors for cut). |
20 | 16 |
|
21 | 17 | Finding and sharing reference icons is a great way to get moving if you're uncertain of the general shape. Post these examples to your issue and we'll provide feedback. |
22 | 18 |
|
23 | 19 | Lastly, we reserve the right to reject any icons that do not fit the EUI style or may be deemed inappropriate. |
24 | 20 |
|
25 | | -### Style |
| 21 | +## Design guidelines |
| 22 | + |
| 23 | +### Linear icon scaling |
| 24 | + |
| 25 | +- Each icon should be comprised of a single vector glyph that can be scaled linearly, up or down. |
| 26 | +- This approach greatly reduces maintenance and implementation complexity. |
| 27 | +- Note that minor icon blurriness/anti-aliasing can occur when icons are sized to dimensions other than those divisible by the source viewbox dimensions. |
| 28 | + |
| 29 | +<img width="622" height="309" alt="linear_icon_scaling" src="https://github.com/user-attachments/assets/87ec63aa-4237-4316-881f-180006d0c09e" /> |
| 30 | + |
| 31 | +### 16x16px viewbox |
| 32 | + |
| 33 | +- All icons should be crafted on a 16x16px viewbox. |
| 34 | +- As this is the default size for all icons in EUI, this will help ensure all icons look their best by default. |
| 35 | + |
| 36 | +<img width="622" height="320" alt="16x16_viewbox" src="https://github.com/user-attachments/assets/fe480f11-56c9-4b6b-bd94-0c12e3d54577" /> |
| 37 | + |
| 38 | +### Strokes only (with some exceptions) |
| 39 | + |
| 40 | +- Nearly all icons should be lined/stroked, using a 1px stroke width (on a 16x16px canvas). |
| 41 | +- In special cases, a filled variant of an icon can be created for concepts that convey a toggle action and need to represent this toggle action in an interface. For example, a star icon may have a filled variant to indicate toggling of “favorite” status. |
| 42 | +- In a very limited subset of icons, a filled variant of an icon can be created for concepts that convey status (check, error, warning). |
| 43 | +- In special cases, a circled variant of an icon can be created for use in empty/tertiary buttons when it comprises of a simple shape that may inadvertently appear awkward or overly diminished otherwise. Examples include simple icons such as a plus or minus. |
| 44 | + |
| 45 | +<img width="622" height="320" alt="strokes_only" src="https://github.com/user-attachments/assets/af7e0da3-f780-41aa-9561-24862f6b8cee" /> |
| 46 | + |
| 47 | +### Snap to pixel grid (when possible) |
| 48 | + |
| 49 | +- When possible, align/snap your icon to the 16x16px viewbox grid. Doing so will ensure that your icon appears as sharp as possible, with little or no blurring/anti-aliasing. |
| 50 | +- It will not always be possible to snap to the grid in all situations. For example, if you have an element of your icon that is 1px and needs to be centered on the 16x16 viewbox, it is impossible to align to the grid in this case. In such situations, it is fine to snap to half-pixel increments in order to center that odd-width element on an even-width canvas. |
| 51 | +- Do not offset your glyph in the viewbox only for the purpose of aligning it to the pixel grid. Doing so may inadvertantly make the icon appear misaligned agaisnt other elements in your design (due to the offset) or create other inconsistencies when compared with similar icons. |
| 52 | + |
| 53 | +<img width="622" height="320" alt="snap_to_pixel" src="https://github.com/user-attachments/assets/e709124e-be89-4b28-addb-c7a3cdda27b8" /> |
| 54 | + |
| 55 | +### Square endpoints only |
| 56 | + |
| 57 | +- All icon strokes should apply square endpoints. Rounded endpoints should never be used. |
| 58 | + |
| 59 | +<img width="622" height="320" alt="square_endpoints_only" src="https://github.com/user-attachments/assets/ebd1fdb3-9e25-44a6-bb60-7e17c9966cc0" /> |
| 60 | + |
| 61 | +### Round outer corners, square inner corners |
| 62 | + |
| 63 | +- All stroke corners should be round on the outside and square on the inside. |
| 64 | +- Outer rounded corner radius should be 1px. How this is put into effect in Figma depends on how your stroke is aligned (ex. inside, center, outside). |
| 65 | + - If stroke is inside, set corner radius to 1px. |
| 66 | + - If stroke is center, set corner radius to 0.5px. |
| 67 | + - If stroke is outside, set stroke join to be round. |
| 68 | +- The only exception to this rule is when the application of rounded outer corners comes at the detriment to the icon being conveyed. In such situations, having both inner and outer corners square is acceptable. |
| 69 | + |
| 70 | +<img width="622" height="320" alt="round_outer_corners" src="https://github.com/user-attachments/assets/010adae6-4b93-438e-9361-9438497ae2bf" /> |
| 71 | + |
| 72 | +### 2D perspective only (with some exceptions) |
| 73 | + |
| 74 | +- Icons with three dimensional perspectives should generally be avoided, unless the concept being conveyed is significantly more identifiable with that perspective (ex. layers). |
| 75 | +- Showing depth or a stacking order of objects (i.e. when something is in front of something else) should be achieved with the use of negative (subtraction) space. |
| 76 | + |
| 77 | +<img width="622" height="320" alt="2d_perspective_only" src="https://github.com/user-attachments/assets/126d6e62-ddcf-4d79-8b3a-98534dd935b6" /> |
| 78 | + |
| 79 | +### 1px safe zone |
| 80 | + |
| 81 | +- At the default 16x16px viewbox, a safe zone of 1px around the viewbox should be kept free of icon elements if possible. Doing so will avoid any inadvertent clipping if/when the icon is scaled. |
| 82 | + |
| 83 | +<img width="622" height="320" alt="1px_safe_zone" src="https://github.com/user-attachments/assets/0c6401d1-ae0e-4311-9b66-c156dd749df0" /> |
26 | 84 |
|
27 | | -This is where things get more opinionated. To maintain a cohesive, high quality icon set, we require that all new glpyhs adhere to the following guidelines: |
| 85 | +### Consistent optical sizing and alignment |
28 | 86 |
|
29 | | -- Use an outline style with a 1 pixel width stroke, straight edges, rounded corners and ends |
30 | | -- Adhere to an overall 16 pixel square shape |
| 87 | +- Icons in close proximity to each other should have similar optical sizing, so as to not appear out-of-place. While this is subjective, designers should still evaluate newly created icons against a variety of existing icons to ensure icons are not disproportionately sized. |
| 88 | +- Utilize the provided keyline shapes for general sizing guidance. |
| 89 | +- Icons should appear optically in the vertical and horizontal center of their viewbox. In most cases, this means simply center aligning the icon in the frame. In other scenarios (ex. triagular shapes), the designer may need to offset the icon slightly in order to appear in the optical center. |
31 | 90 |
|
32 | | - |
| 91 | +<img width="622" height="320" alt="consitent_optical_sizing" src="https://github.com/user-attachments/assets/71471e69-e9c1-4f69-8692-bea9c1942de5" /> |
33 | 92 |
|
34 | | -- Center the glyph in the square leaving a 1 or 2 pixel trim area, where possible |
35 | | -- Align vertical and horizontal paths to a 16x16 pixel grid |
| 93 | +### Descriptive icon naming |
36 | 94 |
|
37 | | - |
| 95 | +- When possible, try to name icons by the object being conveyed. |
| 96 | +- If the object is too abstract or obscure to use for the icon name, naming the icon by the action it is attempting to convey is an acceptable alternative. |
| 97 | +- Grouped/related icons should have a common prefix string to ensure they are in close proximity when in alphabetical order. |
| 98 | +- Common variants should use a consistent suffix string across (ex. Circle, Fill, Slash). Note that if the icon is not a variant, there is no need to apply such a suffix (ex. see the new `info` icon) |
| 99 | +- Icon component and EUI prop names should be in camel case (ex. myIcon). |
| 100 | +- SVG files for inclusion in the EUI repo should be in snake case (ex. my_icon.svg). |
| 101 | +- Apply synonyms for the icon in the Figma component description to ensure designers are able to easily find icons, even if not searching for the exact name. |
38 | 102 |
|
39 | 103 | #### _For Figma users_ |
40 | | -_As a reference, you can view and duplicate our [Figma Icon Template](https://www.figma.com/file/Alv38VIPHGd2cNZYKgtVEe/EUI-Utilities-Icon-Template?node-id=1%3A165). The "template" page within this project contains frames with helper grids, margins, and an example._ |
| 104 | +_As a reference, you can view and duplicate our [Figma Icon Template Component](https://www.figma.com/design/FHys7gLzyvD1gc9DrJM6D8/Elastic-UI--Borealis-?node-id=14007-378&t=hP0dvrW2tEiYGxA0-4)._ |
41 | 105 |
|
42 | 106 | #### _For non-Figma users_ |
43 | 107 | _While we use Figma to maintain our internal design library, you can use any design tool to produce the SVG file._ |
@@ -90,6 +154,7 @@ _\* The Icons page actually contains several sections. In most cases, you will b |
90 | 154 | _\** Run `yarn workspace @elastic/eui-website start` to view the EUI docs site locally._ |
91 | 155 |
|
92 | 156 |
|
93 | | -[icons]: https://elastic.github.io/eui/#/display/icons |
| 157 | +[icons]: https://eui.elastic.co/docs/components/display/icons/#glyphs |
| 158 | +[icon-request-issue]: https://github.com/elastic/eui/issues/new?template=06-icon-request.md |
94 | 159 | [docs]: https://elastic.github.io/eui/ |
95 | 160 | [svg-plugin]: https://www.figma.com/community/plugin/814345141907543603/SVG-Export |
0 commit comments