Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@primer/octicons

primer143.8kMIT19.14.0TypeScript support: definitely-typed

A scalable set of icons handcrafted with <3 by GitHub.

GitHub, icons, svg, octicons

readme

@primer/octicons

npm version

Install

This package is distributed with npm. After installing npm, you can install @primer/octicons with this command:

npm install @primer/octicons

Usage

For all the usages, we recommend using the CSS located in build/build.css. This is some simple CSS to normalize the icons and inherit colors.

After installing @primer/octicons you can access the icons like this:

var octicons = require("@primer/octicons")
octicons.alert
// {
//     symbol: 'alert',
//     keywords: ['warning', 'triangle', 'exclamation', 'point'],
//     toSVG: [Function]
//     heights: {
//         16: {
//             width: 16,
//             path: '<path d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/>',
//             options: {
//                 version: '1.1',
//                 width: '16',
//                 height: '16',
//                 viewBox: '0 0 16 16',
//                 class: 'octicon octicon-alert',
//                 'aria-hidden': 'true'
//             },
//         },
//         24: ...
//     }
// }

There will be a key for every icon, with toSVG and other properties.

Note: alert in the above example can be replaced with any valid icon name. Icons with multi-word names (e.g. arrow-right) cannot be accessed using dot notation (e.g. octicons.alert). Instead, use bracket notation (e.g. octicons['arrow-right']).

octicons[name].symbol

Returns the string of the symbol name, same as the key for that icon.

octicons.x.symbol
// "x"

octicons[name].keywords

Returns an array of keywords for the icon. The data comes from keywords.json. Consider contributing more aliases for the icons.

octicons.x.keywords
// ["remove", "close", "delete"]

octicons[name].heights

Each icon can have multiple SVGs that are designed for different sizes. The heights property allows you to access all the SVGs for an icon using the natural height of the SVG.

octicons.x.heights
// {
//     16: {
//         width: 16,
//         path: '<path d="..."/>',
//         options: {
//             version: '1.1',
//             width: '16',
//             height: '16',
//             viewBox: '0 0 16 16',
//             class: 'octicon octicon-alert',
//             'aria-hidden': 'true'
//         },
//     },
//     24: {
//         width: 24,
//         path: '<path d="..."/>',
//         options: {
//             version: '1.1',
//             width: '24',
//             height: '24',
//             viewBox: '0 0 24 24',
//             class: 'octicon octicon-alert',
//             'aria-hidden': 'true'
//         },
//     },
// }

octicons[name].heights[height].width

Returns the icon's true width, based on the SVG view box width. Note, this doesn't change if you scale it up with size options, it only is the natural width of the icon.

octicons[name].heights[height].path

Returns the string representation of the path of the icon.

octicons.x.heights[16].path
// <path d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path>

octicons[name].heights[height].options

This is an object of all the attributes that will be added to the output tag.

octicons.x.heights[16].options
// { version: '1.1', width: '12', height: '16', viewBox: '0 0 12 16', class: 'octicon octicon-x', 'aria-hidden': 'true' }

octicons[name].toSVG()

Returns a string of the <svg> tag.

octicons.x.toSVG()
// <svg version="1.1" width="12" height="16" viewBox="0 0 12 16" class="octicon octicon-x" aria-hidden="true"><path d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>

The .toSVG() method accepts an optional options object. This is used to add CSS class names, accessibility options, and sizes.

class

Add more CSS classes to the <svg> tag.

octicons.x.toSVG({ "class": "close" })
// <svg version="1.1" width="12" height="16" viewBox="0 0 12 16" class="octicon octicon-x close" aria-hidden="true"><path d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>

aria-label

Add accessibility aria-label to the icon.

octicons.x.toSVG({ "aria-label": "Close the window" })
// <svg version="1.1" width="12" height="16" viewBox="0 0 12 16" class="octicon octicon-x" aria-label="Close the window" role="img"><path d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>

width and height

Size the SVG icon larger using width and height independently or together. .toSVG() will automatically choose the best SVG to render based on the width or height passed in.

octicons.x.toSVG({ "width": 45 })
// <svg version="1.1" width="45" height="45" viewBox="0 0 24 24" class="octicon octicon-x" aria-hidden="true"><path d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>

changelog

Changelog

19.14.0

Minor Changes

19.13.0

Minor Changes

19.12.0

Minor Changes

19.11.0

Minor Changes

19.10.0

Minor Changes

Patch Changes

  • #1020 449d81f1 Thanks @joshblack! - Update types for @primer/octicons-react to explicitly include extensions for different moduleResolution settings

19.9.0

Minor Changes

Patch Changes

  • #1007 79b93954 Thanks @joshblack! - Update octicons in React to no longer set role="img" if the icon is aria-hidden.

19.8.0

Minor Changes

19.7.0

Minor Changes

19.6.0

Minor Changes

19.5.0

Minor Changes

Patch Changes

19.4.0

Minor Changes

  • #962 5805622c Thanks @CameronFoxly! - Edited small details on copilot-warning and copilot-error to maintain consistency with the rest of the copilot icon set.

  • #961 e92cb36a Thanks @gavinmn! - Save file-directory-symlink-16.svg, file-directory-symlink-24.svg

19.3.0

Minor Changes

19.2.0

Minor Changes

19.1.0

Minor Changes

19.0.0

Major Changes

  • #943 a38ae2d2 Thanks @broccolinisoup! - Remove support for Octicon Update peer dependency React version to support >=16.3 Update icons to use React.forwardRef

Minor Changes

18.3.0

Minor Changes

18.2.0

Minor Changes

18.1.0

Minor Changes

18.0.0

Major Changes

  • #914 4d558ed9 Thanks @omerbensaadon! - Update icon naming conventions for Tracks and Tracked By:

    • issue-tracked-byissue-tracks
    • issue-tracked-inissue-tracked-by

Minor Changes

17.12.0

Minor Changes

17.11.1

Patch Changes

17.11.0

Minor Changes

Patch Changes

17.10.2

Patch Changes

  • #886 b5a1530f Thanks @eliperkins! - Upgrade to latest version of SVG Optimizer to remove invalid SVG paths on iOS, macOS and other native Apple target platforms.

17.10.1

Patch Changes

17.10.0

Minor Changes

17.9.0

Minor Changes

  • #862 e15fe00 Thanks @ashygee! - Add project-roadmap icons. Thanks @ohiosveryown and @gavinmn!

  • #861 1a6887d Thanks @ashygee! - Add project-symlink icons. Thanks @peterloveland!

  • #860 8a98d2b Thanks @ashygee! - Save clock-fill-16.svg, clock-fill-24.svg, skip-fill-16.svg, skip-fil… Thanks @dylanatsmith!

17.8.0

Minor Changes

17.7.0

Minor Changes

17.6.0

Minor Changes

Patch Changes

17.5.0

Minor Changes

17.4.1

Patch Changes

17.4.0

Minor Changes

Patch Changes

17.3.0

Minor Changes

17.2.0

Minor Changes

  • #789 d59a5e2 Thanks @ashygee! - Add file-added, file-removed, file-moved Update file to be consistent in height with other file icons

Patch Changes

17.1.0

Minor Changes

17.0.0

Major Changes

  • #736 ec8cab8 Thanks @edokoa! - This patch fixes two problems:

    • We're adding a non-filled file-directory icon to the set.
    • We're fixing a problem where the 16px and 24px versions of the file-directory icons were mismatched between fill and non-fill versions of the icon.

    THIS IS A BREAKING CHANGE and will require re-linking all the file-directory icon references to file-directory-fill

Minor Changes

Patch Changes

16.3.1

Patch Changes

16.3.0

Minor Changes

  • #715 ab991ab Thanks @edokoa! - Added new icons for:

    • accessibility
    • apps
    • id-badge
    • log
    • repo-deleted
    • tab-external
    • webhook
  • #708 6933ac3 Thanks @Juliusschaeper! - Added first batch of 16px feed icons:

    • feed-discussion
    • feed-heart
    • feed-person
    • feed-repo
    • feed-rocket
    • feed-star
    • feed-tag

16.2.0

Minor Changes

Patch Changes

  • #685 c59c097 Thanks @jonrohan! - Formatting changes to the main readme file, including dark mode support.

16.1.1

Patch Changes

16.1.0

🚀 New features

🐛 Bug fix

16.0.0

💥 Breaking changes

🚀 New features

🧽 Chores

  • Bump dependencies

15.2.0

🚀 New features

15.1.0

🚀 New features

15.0.1

🐛 Bug fix

15.0.0

💥 Breaking changes

14.2.2

🐛 Bug fix

14.2.1

🐛 Bug fix

14.2.0

🚀 New features

🧽 Chores

14.1.0

🚀 New features

14.0.0

💥 Breaking changes

🚀 New features

💅 Enhancements

🐛 Fixes

13.0.0

🚀 New features

💥 Breaking changes

💅 Enhancements

🐛 Fixes

12.1.0

React

💅 Enhancements

12.0.0

🚀 New features

💅 Enhancements

  • Make octicon helper slightly faster (@jhawthorn & @seejohnrun) (#536)

💥 Breaking changes

🧽Chores

  • Dependency updates (#525, #524, #523, #522, #520)

11.3.0

🚀 New features

🐛 Fixes

11.2.0

🚀 New features

🐛 Fixes

🧽Chores

  • Dependency updates

11.1.0

🚀 New features

🐛 Fixes

11.0.0

💅 Enhancements

💥 Breaking changes

10.1.0

🚀 New features

🐛 Fixes

  • Corrected positioning for triangle-down #459

🧽Chores

  • Dependency updates

10.0.0

All packages

  • We've given Octicons a new look ✨ Some icons have new names and some icons haven't been redesigned yet. The following table documents those changes. If you're using an octicon in v9.x that doesn't have an equivalent in v10.0 yet, let us know by opening an issue.
v9.x v10.0 Notes
arrow-small-down arrow-down
arrow-small-left arrow-left
arrow-small-right arrow-right
arrow-small-up arrow-up
browser | Request this icon
bug | Request this icon
circuit-board cpu
cloud-download download
cloud-upload upload
dashboard meter
dependent package-dependents
device-camera | Request this icon
file-pdf file
file-symlink-directory file-submodule
gist-secret lock
gist code-square
github-action | Request this icon
heart-outline heart
internal-repo repo
jersey people
keyboard | Request this icon
line-arrow-down arrow-down
line-arrow-left arrow-left
line-arrow-right arrow-right
line-arrow-up arrow-up
mail-read mail
no-newline no-entry
paintcan paintbrush
plus-small plus
primitive-dot-stroke dot
primitive-dot dot-fill
primitive-square square-fill
radio-tower broadcast
repo-clone | Request this icon
repo-force-push repo-push
repo-pull | Request this icon
repo-template-private | Request this icon
request-changes diff
saved bookmark
text-size heading or typography
unsaved bookmark-slash
watch hourglass
workflow-all | Request this icon
  • We designed a set of 24px icons—as well as 16px icons—to accommodate interfaces that need larger icons. All package implementations now choose which SVG to render based on the size passed in.

React (@primer/octicons-react)

  • Icon components (e.g. AlertIcon, ArrowRightIcon, etc.) now accept size, ariaLabel, verticalAlign, and className props and can be used on their own. No need to pass them to the Octicon component.

    <AlertIcon size={24} />
  • Icon components will now choose the best SVG icon to render based on the size passed in.

  • The Octicon component is deprecated. Use icon components on their own instead:

    - <Octicon icon={AlertIcon} />
    + <AlertIcon />

BREAKING CHANGES 💥

  • All icon component names now include Icon at the end (e.g. AlertAlertIcon).

  • In order to enable tree-shaking, we removed the iconsByName and getIconByName exports.

  • Octicon no longer accepts width or height props. Use the size prop instead. In cases where the width and height of an icon are not equal (e.g. logos), the height will be set to the value of the size prop and the width will be scaled proportionally.

  • We renamed the ariaLabel prop to aria-label to be consistent with React: https://reactjs.org/docs/accessibility.html#wai-aria

    - <AlertIcon ariaLabel="alert">
    + <AlertIcon aria-label="alert">
  • Setting verticalAlign="top" on the Octicon component or any icon component will now apply a vertical-align: top; style to the <svg>. Previously, we were translating "top" to "text-top." So setting verticalAlign="top" would apply a vertical-align: text-top; style to the <svg>. If you want a vertical alignment of "text-top," set the verticalAlign prop to "text-top".

  • Custom icon components passed to the Octicon component now need to render the entire <svg>, not just the <path>.

function CirclesIcon() {
  return (
-   <React.Fragment>
+   <svg viewBox="0 0 30 10" width="30" height="10">
      <circle r={5} cx={5} cy={5}/>
      <circle r={5} cx={15} cy={5}/>
      <circle r={5} cx={25} cy={5}/>
-   </React.Fragment>
+   </svg>
  )
}

- CirclesIcon.size = [30, 10]

JavaScript (@primer/octicons)

BREAKING CHANGES 💥

  • The structure of each icon object has been updated to allow support multiple SVGs per icon:
Before
octicons.alert
// {
//     symbol: 'alert',
//     keywords: ['warning', 'triangle', 'exclamation', 'point'],
//     toSVG: [Function],
//     width: 16,
//     height: 16,
//     path: '<path d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/>',
//     options: {
//         version: '1.1',
//         width: '16',
//         height: '16',
//         viewBox: '0 0 16 16',
//         class: 'octicon octicon-alert',
//         'aria-hidden': 'true'
//     },
// }

After

octicons.alert
// {
//     symbol: 'alert',
//     keywords: ['warning', 'triangle', 'exclamation', 'point'],
//     toSVG: [Function]
//     heights: {
//         16: {
//             width: 16,
//             path: '<path d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/>',
//             options: {
//                 version: '1.1',
//                 width: '16',
//                 height: '16',
//                 viewBox: '0 0 16 16',
//                 class: 'octicon octicon-alert',
//                 'aria-hidden': 'true'
//             },
//         },
//         24: ...
//     }
// }

9.6.0

features

9.5.0

features

9.4.0

features

Chores

  • Contributing docs updates and issue template updates #367

Bugs

9.3.1

Bugfix

  • Workflow icon had a cutoff edge.

9.3.0

🚀 New features

9.2.0

🚀 New features

🧽 Chores

🐛 Bugs

9.1.1

🐛 Bug Fix

9.1.0

🚀 New features

9.0.0

💥 Breaking changes

🚀 New features

8.5.0

8.4.2

💅🏼 Enhancement

🐛 Bug Fix

8.4.1

🐛 Bug Fix

8.4.0

🏠 Internal

Committers: 1

8.3.0

8.2.0

  • Add fold-up and fold-down icons, courtesy of @pmarsceill

8.1.3

  • Add eye-closed icon, courtesy of @colinkeany

8.1.2

  • Patch release for failed 8.1.1 release

8.1.1

8.1.0

  • Add the arrow-both icon courtesy of @venetucci
  • TypeScript types are now available thanks to @j-f1!
  • Fix CI builds for outside contributors (as long as they aren't changing octicons)
  • Fix typo in README
  • Update README with @githubprimer/octicons-react scope
  • Publish release candidates from any branch beginning with release

8.0.0

7.4.0

  • This release marks the first official version of Octicons for React! Check out the @github/octicons-react package on npm for more info, or peruse the long-running PR #222.
  • CI status is now reported to the #design-ops Slack channel
  • Jekyll Octicons has moved in this repo from lib/jekyll-octicons to lib/octicons_jekyll

7.3.0

Archived releases

Octicons_node 7.0.0

  • Removing file-text and mail-reply icons. Use file and reply respectively.
  • Removing spritesheet calls and toSVGUse method.

Octicons_gem 5.0.4

  • Removing file-text and mail-reply icons. Use file and reply respectively.
  • Removing spritesheet calls and to_svg_use method.

6.0.1

Fixes:

  • Typo kebab-veritcal becomes kebab-vertical

6.0.0

Added:

  • kebab-horizontal and kebab-vertical icons
  • Polyfill for the Object.assign function

Removes:

  • Removing a duplicate ellipses icon from the set. Use ellipsis instead.

5.0.1

Fixes:

  • projects icon renders as a block, using fill-rule fixes it

5.0.0

Adds:

Removes:

4.4.0

Adds:

  • svg.json file that is accessible from node require

4.3.0

Fixes:

  • Vertical alignment on italic

Modifies:

  • person
  • organization

4.2.1

Fixes:

  • Removing inline sourcemap from min versions of css.

4.2.0

Adds:

  • Keywords.json file that has an index of all octicons with alias names

4.1.1 (June 16, 2016)

Fixes:

  • Putting the $octicons-font-path back in the scss file.

4.1.0 (June 6, 2016)

Adds:

Modifies:

  • smiley

Refines:

  • Renames mail-reply to reply and refines its shape.

Fixes:

  • Revert license back to SPDX standard

4.0.0 (June 6, 2016)

Adds:

Removes:

  • Bower support

Fixes:

3.5.0 (February 12, 2016)

Adds:

  • unverified

Refines:

  • verified

3.4.1 (January 24, 2016)

This includes various SVG viewport refinements.

Refines:

  • thumbs-down
  • logo-github

3.4.0 (January 22, 2016)

Adds:

  • verified
  • smiley

Removes:

  • color-mode

Refines:

  • primitive-dot
  • horizontal-rule
  • triangle-down
  • triangle-up
  • triangle-left
  • triangle-right
  • globe
  • flame
  • comment-discussion

3.3.0 (November 12, 2015)

Adds:

  • logo-gist

Resizes all our SVG to be 16x16 instead of 1024x1024

3.2.0 (November 6, 2015)

Adds:

  • bold
  • text-size
  • italic
  • tasklist

It also normalizes some styling in:

  • list-unordered
  • list-ordered
  • quote
  • mention
  • bookmark
  • threebars

Removes

  • screen-normal
  • screen-full

3.1.0 (August 13, 2015)

Adds

  • shield

This thickens stroke widths slightly on the following icons:

  • circle-slash
  • clock
  • cloud-upload
  • cloud-download
  • dashboard
  • info
  • issue-closed
  • issue
  • issue-reopened
  • history
  • question
  • search

Fills comment-discussion

Thickens x to match checkmark

3.0.1 (August 10, 2015)

Some files were missing in 3.0.0

3.0.0 (August 10, 2015)

Removes

  • microscope
  • beer
  • split
  • puzzle
  • steps
  • podium
  • timer
  • all alignment icons
  • all move icons
  • all playback icons
  • all jump icons

Adds

  • beaker
  • bell
  • desktop-download
  • watch

Line-weight changes, sizing normalization, and new drawings

  • circle-slash
  • lock
  • cloud-upload
  • cloud-download
  • plus
  • broadcast
  • lock
  • all repo icons
  • organization
  • person
  • all chevrons & triangles
  • all diff icons
  • clippy
  • all issue and circular icons
  • rss
  • ruby
  • cancel
  • settings
  • mirror
  • external-link
  • history
  • gear
  • settings
  • info
  • history
  • package
  • gist-secret
  • rocket
  • law
  • telescope
  • search
  • tag
  • normal-screen
  • iphone
  • no-new-line
  • desktop
  • all git icons
  • circuit-board
  • heart
  • home
  • briefcase
  • wiki
  • bookmark
  • briefcase
  • calendar
  • color-mode
  • comment
  • discussions
  • credit-card
  • dashboard
  • camera
  • video
  • bug
  • desktop
  • ellipses
  • eye
  • all files & folders
  • fold
  • unfold
  • gift
  • graph
  • hubot
  • inbox
  • jersey
  • keyboard
  • light-bulb
  • link
  • location
  • mail
  • mail-read
  • marker
  • plug
  • mute
  • pencil
  • push-pin
  • fullscreen
  • unfullscreen
  • server
  • sign-in
  • sign-out
  • tag
  • terminal
  • thumbs-up
  • thumbs-down
  • trash
  • unmute
  • versions
  • gist
  • key
  • megaphone
  • checklist

2.4.1 (June 2, 2015)

  • Add the scss file I forgot to include

2.4.0 (June 2, 2015)

  • Add octicons.scss
  • Revert path changes to sprockets-octicons.scss, as they broke octicons in sprockets.

2.3.0 (May 28, 2015)

  • Add a path variable to sprockets-octicons.scss to be consistent with octicons.less`

2.2.3 (May 21, 2015)

  • Use SPDX license identifiers in package.json

2.2.2 (April 1, 2015)

Fixes file icons for

  • file-binary
  • file-code
  • file-media
  • file-pdf
  • file-symlink-file
  • file-text
  • file-zip

2.2.1 (March 30, 2015)

  • Fix vector artifact and smooth curves in mark-github

2.2.0 (Feb 18, 2015)

  • Add two new icons: thumbsup and thumbsdown

2.0.1 (June 16, 2014)

  • Add mention of github.com/logos to the license

2.0.0 (June 16, 2014)

  • Hello world