Skip to content

Chip & badge ​

Short labelled values: a status, an entity type or a linked entity.

metadata-metadataformatterpill--chipsOpen in Storybook ↗

When to use ​

  • Chip: a short status or category value, such as Concept or Published.
  • Badge: the type of the current record as a short code, such as M for a manifestation, before its title in the breadcrumb.
  • Relation chip: a value that is another entity, such as a person linked to a record.

When not to use ​

  • Actions: a chip never changes anything by itself. Use a button.
  • Long text: chips hold one or two words. Longer values stay plain text.
  • Meaning by colour alone: a chip always has text; a badge always has its code as text.

Anatomy ​

  1. Container: --radius-chip corners, --chip-padding.
  2. Icon (optional): before the label; it can spin, for a status that is in progress.
  3. Label: --text-chip, bold.

A badge is a short code, centred, at least as wide as it is high (--badge-size, --badge-padding-x, --text-badge).

A nested chip is a relation chip with small value chips inside, such as an organisation with the person's functions.

Variants ​

VariantColourWhere it comes from
Status chipa tone, or colours from the client's configurationthe value's raw (untranslated) key in the pill configuration
Type badge--color-chip-relation-bg / -textthe record's type code, in the breadcrumb
Relation chip--color-chip-relation-bg / -text, the same on every clientrelation fields
Value chip--color-chip-value-bg / -text, derived from the client accentselected values in dropdowns and tag inputs

The breadcrumb shows the type badge before the current record's title:

components-breadcrumb--type-badgeOpen in Storybook ↗

Configuring colours. A client's pill configuration sets a value's colours, either as explicit colours or as one of three tones (--color-badge-tone{1,2,3}-{bg,text}) plus a subtype tone. There is no fourth tone. A value without configuration is shown as plain text. The same configuration can turn a value into a letter badge (shape: "badge" with a letter). The examples below show what such a configuration produces; they are not part of any client's setup.

metadata-metadataformatterpill--badgesOpen in Storybook ↗

A large size exists for column headings when records are compared side by side (--text-chip-lg, --chip-padding-lg).

States ​

Chips and badges are static: they have no hover, focus or pressed state of their own. When a relation chip links to its entity, the surrounding field makes it clickable and shows the pointer and hover colour.

Keyboard & accessibility ​

  • A badge is role="img" with its value as the aria-label. For the type badge in the breadcrumb that is the code itself, such as M. A configured letter badge is named by the value's translated name.
  • Nested value chips have a title naming the field they come from.
  • Every tone and chip colour pair meets 4.5:1 contrast. See Accessibility.

Content ​

  • One or two words, sentence case: Concept, In review.
  • A configured letter badge uses the first letter of the value unless the configuration sets another one; keep letters unique within a client.
  • Values are configured by their raw key, so a translated label never changes which colour a value gets.

Colour · Client theming · Button

Powered by Elody - Open Source Semantic Data Platform