Icons
Icons are visual symbols used to represent ideas, objects, or actions. They communicate messages at a glance, afford interactivity, and draw attention to important information.
Resources
Designing with icons
Sizing
Carbon components typically use icons on 16px artboards. Icons on 20px, 24px, and 32px artboards can also be used within the UI. Be sure icon size is consistent throughout your product.
16px and 20px icons are optimized to feel balanced when paired with 14pt and 16pt IBM Plex. Use 24px and 32px when larger icons are needed.
Do use the correct icon size with IBM Plex.
Don’t alter the icon-text size ratio.
Touch targets
All touch targets for interactive icons need to be 44px or larger. Developers can add padding to a touch target with CSS to meet the 44px requirement.
The menu button that is also a touch target may have a 20px ✕ 20px icon centered in a 48px ✕ 48px button.
Color
Icons are always a solid, monochromatic color and need to pass the same color contrast ratio as typography (4.5:1). The color of the icon should reflect the importance of the icon’s action which should always be to help guide a user. For more information on color, see the Color guidelines.
It’s also important to note that Carbon v10 icons themselves do not have interaction states, only their backgrounds do.
![proper alignment proper alignment](/static/863d980822f0e6048b0a95016800380d/16db8/iconography-color-01.png)
Do match your icon color with your text color when pairing them.
![improper alignment improper alignment](/static/c75db7b219607bde242485fcb42e7530/16db8/iconography-color-02.png)
Don’t use different colors for text and icons.
Alignment
When used next to text, icons should be center-aligned.
Do center-align icons when they’re next to text.
Don’t baseline-align icons to the text.
Developing with icons
SVG Icons
Requirements:
Install carbon-icons
.
Full installation details can be found in the Carbon icons GitHub repo.
Main files
carbon-icons
ships with two main SVG files:
Filename | Description | Supported versions |
---|---|---|
carbon-icons.svg | Contains current icons (consolidated subset of legacy icons used in IBM Bluemix) | 3.x & newer |
carbon-icons.json | JSON file created from carbon-icons.svg, used in Carbon | 3.x & newer |
carbon-icons.js | JS module created from carbon-icons.svg, used in Icon React Component in carbon-components-react | 3.x & newer |
icons.json | legacy JSON file created from sprite.svg | 1.x ,2.x &3.x |
legacy-icons.js | JS module created from sprite.svg | 3.x only |
Accessibility
For screen reader accessibility, provide a context-rich title for the SVG using <title>
element.
<svg><title>Add a new service</title><use xlink:href="/carbon-icons/dist/icon--add--glyph"></use></svg>
If support for older browsers is needed, use the aria-labelledby
attribute to reference the <title>
element using an id
.
The <title>
element will be read by the screen reader to the user, so it should describe its purpose.
Make sure that you do not duplicate this id
.
<svg aria-labelledby="add"><title id="add">Add a new service</title><use xlink:href="/carbon-icons/dist/icon--add"></use></svg>
For more details on accessibility, see the following resources:
- “Accessible SVGs” via CSS-Tricks
- “5.4 The ‘desc’ and ‘title’ elements” via W3C.org