When to use
Section titled “When to use”Tag classifies an item with a short word or shows a selection. Use it for category labels, applied filters and recipient lists. Add onRemove when users can remove the tag, and selected when it switches a filter on and off.
When not to use
Section titled “When not to use”- To report a status: use StatusBadge or Badge for states such as draft, active or failed; a Tag shows a value the user assigned or picked.
- To show a number: use Badge for small counters such as an unread count.
- To start an action: a Tag does not act. Use Button for actions.
- For long text: a label should be one or two words; longer text is cut off on one line.
Anatomy
Section titled “Anatomy”- Root: 1 px border, transparent background and 6 px (
radius-sm) corners. - Selection mark (selectable only): a check mark that appears on selection.
- Icon (
Tag.Icon): optional, decorative, 12 or 16 px. - Label (
Tag.Label): 14 px semibold text; truncated when wider than its container. - Remove (
Tag.Remove): only on a removable tag, a button with a 24 px target. - Group (
Tag.Group): gathers the tags as a named list (role="list").
Behaviour
Section titled “Behaviour”- A static tag does not change on hover or click and is not a tab stop.
- On a removable tag only the remove button takes focus; Enter, Space, click, Backspace and Delete remove the tag.
- The whole selectable tag is one button; Enter and Space change its state.
- A tag cannot be both selectable and removable; the prop types prevent it.
- In a
Tag.Group, when a tag is removed focus moves to the next tag’s button, else the previous one, else theonEmptytarget. There is no arrow-key navigation; each remove button is its own tab stop. - A tag added to a group rises 4 px as it appears. Removal is immediate; there is no exit animation.
- A selectable tag reserves room for the check mark, so its width does not change when selected.
Guidelines
Section titled “Guidelines”Keep the label short
Section titled “Keep the label short”Write one or two words. Sentences and descriptions are not labels.
Group removable tags
Section titled “Group removable tags”Put removable tags in a Tag.Group: the list is named and focus management works.
Let the text carry the meaning
Section titled “Let the text carry the meaning”The tone only emphasises. Colour alone should not carry a meaning.
Use tones sparingly
Section titled “Use tones sparingly”Keep most tags in one row neutral; a tone should mark a real difference.
Content
Section titled “Content”- Write the label in sentence case with one or two words: “Design”, “Development”.
- Do not add a full stop or a colon.
- Do not write the remove button’s name; the library builds “Remove Design” from the label.
- Keep tags of one kind in one group: all categories, or all recipients.
Related components
Section titled “Related components”- Badge: shows a status or a counter.
- StatusBadge: shows a status from a fixed vocabulary.
- Button: starts an action.