Skip to main content

Badge Content

The standard way to specify badges is using a string in the tags/badges array:

tags: ['beta'],
// or
tags: [BADGE.BETA], // using the BADGE utility map

When used in this way, the value in the array ('beta' in the above example) is used to lookup the definition in the badgeMap. If it finds a definition, it will use that to determine the appearance of the badge, its content, and where it appears.

Delimited Badges

Badges can also use a delimiter to split the badge up into its ID (used to lookup the definition in the badgeMap), and its content (the text that is displayed on the badge).

The default delimiter is ':', but this can be overridden in:

  • The badgeMap to apply to all badges unless overridden
  • A matcher to apply to badges found by the matcher
// With the default delimiter (':'), this badge:
tags: ['version:1.0.0']

// Would be turned into:
badgeId: 'version',
content: '1.0.0'

The badgeId portion is then used to lookup the badge's definition in the badgeMap. The content part is then passed in to any BadgeFunction, or displayed in a badge without a title definition.

Display Content Only

The displayContentOnly setting from the badgesConfig, BadgeConfig, or matcher controls whether the content passed into BadgeFunctions contains just the content portion, or the whole badge string.

In most cases, you won't need to touch this, unless you'd prefer that the badge displays the whole string passed to tags/badges when using delimiters.