Skip to content

Labels

  • Stable
  • Not reviewed for accessibility

Labels add metadata or indicate status of items and navigational elements.

Labels

The base label component styles the text, adds padding and rounded corners, and a border. Labels come in various themes which apply different colors.

GitHub also programmatically generates and applies a background color for labels on items such as issues and pull requests. Users are able to select any background color and the text color will adjust to work with light and dark background colors.

The base Label style does not apply a background color and only uses the default border:

Label contrast

Use Label--primary to create a label with a stronger border. This label is also neutral in color, however, since its border is stronger it can stand out more compared to the default Label.

Use Label--secondary to create a label with a subtler text color. This label is neutral in color and can be used in contexts where all you need to communicate is metadata, or where you want a label to feel less prominent compared with labels with stronger colors.

Colored labels

Labels come in a few different functional classes. Use to communicate the content of the label, and ensure it's used consistently.

  • Label--accent
  • Label--success
  • Label--attention
  • Label--severe
  • Label--danger
  • Label--open
  • Label--closed
  • Label--done
  • Label--sponsors

Label sizes

If space allows, add the Label--large modifier to add a bit more padding to labels.

Inline labels

Sometimes when adding a label the line-height can be increased. Or the parent element increases in height. If that is not desired, use the Label--inline modifier change to the display property to inline. The font-size also adapts.

Issue labels

Issue labels are used for adding labels to issues and pull requests. They also come with emoji support.

If an issue label needs to be bigger, add the .IssueLabel--big modifier.

Diffstat

Diffstats show how many deletions or additions a diff has. It's typically a row of 5 blocks that get colored with green or red.

Use the color-fg-success and color-fg-danger utilities to add additional information about the size of the diff.

Edit this page on GitHub
7 contributorssimuraialliethujonrohanshoedlerkoddssonyailicolebemis
Last edited by simurai on December 16, 2022