Tag

A short label in a chip: a status, a category or a person. Specification: docs/components/tag.md

Emphasis × size

data-emphasis high, medium and low, then without it, at each data-size.

Label Label Label Label
Label Label Label Label
Label Label Label Label
Label Label Label Label

Every size

xs to 2xl. Canon has three tag sizes: xs shows as sm, and xl and 2xl as lg.

xs sm md lg xl 2xl

Meaning: data-intent

Use data-intent when the color means something: a status. Statuses can look different from categories (here, rounder and in capitals), so the two are never confused. High, medium and low emphasis, then with a dot.

infoBetaBetaBetaBeta
successApprovedApprovedApprovedApproved
warningPendingPendingPendingPending
dangerOverdueOverdueOverdueOverdue

Identity: data-seed

Use data-seed when the color only tells tags apart: categories, labels, people. Pass a stable number (an id); it always picks the same color, the same one an avatar with that seed gets. High, medium and low emphasis.

No seedLabelLabelLabel
0 (blue)LabelLabelLabel
1 (sky)LabelLabelLabel
2 (cyan)LabelLabelLabel
3 (teal)LabelLabelLabel
4 (emerald)LabelLabelLabel
5 (green)LabelLabelLabel
6 (lime)LabelLabelLabel
7 (yellow)LabelLabelLabel
8 (amber)LabelLabelLabel
9 (orange)LabelLabelLabel
10 (red)LabelLabelLabel
11 (rose)LabelLabelLabel
12 (pink)LabelLabelLabel
13 (fuchsia)LabelLabelLabel
14 (purple)LabelLabelLabel
15 (violet)LabelLabelLabel
16 (indigo)LabelLabelLabel

Same seed, avatar and tag

GH Grace Hopper AT Alan Turing

Not an integer

Seeds are integers. Anything else, like data-seed="abc", gives the neutral color.

Label Label Label

Content

Everything at once

Avatar, leading icon, dot, label, trailing icon and key, in that order. High, medium and low emphasis.

Label ⌘K Label ⌘K Label ⌘K
Label ⌘K Label ⌘K Label ⌘K
Label ⌘K Label ⌘K Label ⌘K

One at a time

Approved Design Active Draft Ada Lovelace Grace Hopper Search⌘K

Icon only

With data-display="icon" the label is hidden but still read by screen readers, and the tag becomes square.

Starred Starred Starred Pinned Ada Lovelace

Removable

A <button type="button" class="canon-tag-remove"> last, named after the tag ("Remove Design"). Removing the tag is up to your app; a Combobox with several values makes these for you.

Option 1 Design Done Ada Lovelace
Option 1 Design Outlined Solid
Option 1 Design

In context

A list of tags

Several tags are a <ul>, one per <li>.

In running text

The request is Pending until a reviewer from Design approves it.

Larger text, larger tags: Approved by Ada Lovelace

On other surfaces

Neutral tags take their colors from the text around them, so they stay visible on gray and dark panels.

Label Label Label Label Search⌘K Search⌘K
Label Label Label Search⌘K Search⌘K Label

Edge cases

Right-to-left

In right-to-left text the avatar and leading icon move to the right; the key still reads left to right.

Label ⌘K تمت الموافقة قيد الانتظار

Long labels in a narrow container

When space runs out the label is cut short with an ellipsis; icons, dot, avatar and key stay whole.

An exceptionally long category name Overdue since last Tuesday afternoon Open the command palette⇧⌘P Ada Augusta King, Countess of Lovelace

Rows that wrap

  • One
  • Two
  • Three
  • Four
  • Five
  • Six
  • Seven