
Icon
Icons at GitHub are called Octicons, which are available in various implementations including React, Figma, Rails, and Styled System.
Library
At Primer, we utilize the Octicons icon library. This package is available in Ruby, Jekyll, JavaScript, React and Styled System.
Usage
Icons are most appropriate for representing simple, recognizable concepts or actions. When choosing icons for your design system, consider the following guidelines:
- Where possible use icons to supplement text, rather than replacing it.
- Make sure that the meaning of icons is clear when used without accompanying text.
- Choose icons that are easy to recognize and accurately depict the concept or action.
- Maintain consistency in the use of icons across your product or brand.
- Avoid using icons for complex or abstract concepts that may be confusing to some users.
- Adhere to predetermined icon sizes to ensure legibility and ease of recognition.
- Test the effectiveness of your icons with users to ensure that they are understood and useful in navigating the interface.
Color
To ensure that icons are effective and legible in different color modes, it is recommended to use our functional foreground colors.
Many of our components are designed to automatically set the color of icons to a predetermined color. For example, banners are configured to set the icon to the matching role color by default.
Some icons should always be shown in a specific colors when used within a specific context. This helps to effectively convey their intended meaning and provide a consistent user experience. Here are a few examples:
Example | Icon | Color variable | Usage |
---|---|---|---|
info | fg.accent | Important information | |
check | fg.success | Successful, passing, or positive result | |
x | fg.danger | Error, danger, or negative result | |
alert | fg.attention | Warning |
Sizes

Octicons are available in three sizes: 12px
, 16px
and 24px
. To maintain consistency in stroke width and legibility, it is important to use these icons only at their designated sizes.
✓ Do
Keep icons in their original size.
✗ Don't
Don't resize icons.
System vs user-selectable
There are two types of icons: system
and user-selectable
icons.
System
are used to represent core actions and concepts within the user interface. These icons are typically used consistently throughout the product and are an important part of our visual language. Examples of system
icons might include a trash icon for deleting items, or a plus-circle icon for adding new items.
User-selectable
icons, on the other hand, are used to allow users to customize their experience or make a personal connection with the product. User-selectable
icons are typically less central to the functionality of the user interface and may be changed by the user as desired.
✓ Do
Use emojis as user-selectable icons.
✗ Don't
Don't use Octicons for user-selectable icons.
States
To display the state of an action, use a stroke and fill icon combination or its opposite version if available. For "off" or "empty" states, use the outline icon.
✓ Do
Stick to predefined icon pairs.
✗ Don't
Create your own icon pairs.
Creating new icons
If you are unable to find the icon you need in our Octicons library, you may want to create a new icon. Follow our Octicons design guidelines for guidance on creating a new icon that fits with the visual language of our design system. Keep in mind that new icons should be added only when they are necessary and meet the guidelines for use.
Accessibility and usability expectations
If the icon is purely decorative and does not convey any meaning (for instance, if adjacent text already provides all the necessary information/context), it is hidden from screen readers.
If the icon does convey meaning, the component exposes a role="img"
so that its purpose will be described by assistive technologies, and the component's aria-label
contains the accessible name / text alternative for the icon.
The accessible name or decision to make it decorative should be included in the design annotation.