Skip to main content
Login

Sign in to access your account

Tags - National Design System

A tag is a small read-only label for a category, a status or metadata

Overview

A tag is a small <span> with the nds-tag class and a label, with an optional icon. A standard tag shows a category or metadata, such as a topic, a type or a region. A status tag carries data-status and shows the state of an item, such as a request or an order, with a dot before the label. Tags sit together in an nds-tags group.

Pick another component when:

  • the user clicks the label to pick a choice or to remove a value: Chips
  • the user types the values into a field: Tag Input

Markup

Options
Structure
Color
Status
Style
Size
Content
More
Preview
Riyadh
<span class="nds-tag"> <span class="nds-label">Riyadh</span> </span>

Built-in Features

  • Pure CSS

    Tags need no JavaScript. Every color, style and size comes from classes and attributes.

  • Label Truncation

    A long label stays on one line and ends with an ellipsis at 160px. A tag never grows wider than its container: it shrinks first, and the label is cut sooner.

  • Color by Class or Status

    A class such as nds-green colors a standard tag. data-status colors a status tag, which ignores the color classes.

  • Accessible Icon Only

    An icon-only tag hides its label from view but not from screen readers, so the tag keeps its name.

Best Practices

  • Use tags for labels that people read and do not click. For a label the user picks or removes, use Chips.
  • Use a status tag for the state of an item. Write the state in the label: every status shows the same dot, so the color alone does not name it.
  • Show a state with a status tag, also when the brief asks for an icon or a shape for each state. Its label names the state, so color is not the only cue.
  • Do not put an icon in a status tag: it shows beside the dot, so the tag has two markers. A standard tag with a color class and an icon shows a category, never a state.
  • Pick the color by meaning, and give tags of the same kind the same color.
  • Pick the style by weight. A standard tag is light, or outline to stay quiet. A status tag is light, dark to stand out, or ghost to stay quiet.
  • Keep labels to one to three words. A label longer than 160px ends with an ellipsis.
  • Put related tags in one nds-tags group, so they share the gap and wrap together.
  • In a List, leave the size class off. The list makes a tag SM, a small list (nds-sm) XS, and a large list (nds-lg) MD. To keep one tag at 32px there, give it nds-md.
  • Keep the label of an icon-only tag, and give its icon aria-hidden="true". Screen readers read the label.
  • On a deep primary surface, give the surface data-theme="dark oncolor primary": a standard tag takes the DGA white look, and a status tag its dark-mode colors. See Color Areas. On a neutral or other dark surface, give it data-theme="dark": every tag takes its dark-mode colors. For one standard tag, add nds-oncolor.

API

Data Attributes

Attribute Element Effect
data-status .nds-tag neutral, success, info, warning, error or critical makes a status tag: a dot before the label and fully round ends. It ignores the color classes. critical gives the Error look: keep it for system-level alerts

Other Classes

Class Element Effect
nds-neutral .nds-tag The same as no color class
nds-gray .nds-tag The same as no color class

CSS Custom Properties

Set these on the tag, or on a parent to reach every tag inside it. They win over the size classes, the color classes, the statuses and the styles.

Property Default Controls
--tag-bg var(--tag-background-neutral-light) Background
--tag-text var(--tag-text-neutral) Label color
--tag-border var(--tag-border-neutral-light) Border color
--tag-icon var(--tag-icon-neutral) Icon and status dot color
--tag-height 32px Height. An icon-only tag uses it as its width too
--tag-fs var(--typo-text-md-FS) Font size
--tag-padding-inline var(--spacing-lg) Padding at the start and the end
--tag-dot-size 10px Size of the status dot
--tag-label-max 160px Widest the label gets before it ends with an ellipsis

Tokens

Set a token at :root, or on a wrapper to reach every tag inside it. Give a token with a Dark mode value a dark override too: see Tokens.

Source: the tag group in _sass/tokens/_components.scss.

TokenPreviewValue
--tag-background-neutralvar(--colors-neutral-600)
--tag-background-neutral-light
var(--colors-neutral-50)
Dark mode var(--colors-alpha-white-10)
--tag-background-oncolorvar(--colors-alpha-white-20)
--tag-text-neutral
var(--colors-neutral-800)
Dark mode var(--colors-neutral-100)
--tag-text-success
var(--colors-green-800)
Dark mode var(--colors-green-400)
--tag-text-info
var(--colors-blue-800)
Dark mode var(--colors-blue-400)
--tag-text-warning
var(--colors-yellow-800)
Dark mode var(--colors-yellow-400)
--tag-text-error
var(--colors-red-800)
Dark mode var(--colors-red-400)
--tag-icon-neutral
var(--colors-neutral-800)
Dark mode var(--colors-neutral-300)
--tag-icon-success
var(--colors-green-800)
Dark mode var(--colors-green-400)
--tag-icon-info
var(--colors-blue-800)
Dark mode var(--colors-blue-400)
--tag-icon-warning
var(--colors-yellow-800)
Dark mode var(--colors-yellow-400)
--tag-icon-error
var(--colors-red-800)
Dark mode var(--colors-red-400)
--tag-background-successvar(--colors-green-700)
--tag-background-success-light
var(--background-success-light)
Dark mode var(--colors-green-alpha-10)
--tag-background-infovar(--colors-blue-600)
--tag-background-info-light
var(--background-info-light)
Dark mode var(--colors-blue-alpha-10)
--tag-background-warningvar(--colors-yellow-700)
--tag-background-warning-light
var(--background-warning-light)
Dark mode var(--colors-yellow-alpha-10)
--tag-background-errorvar(--colors-red-600)
--tag-background-error-light
var(--background-error-light)
Dark mode var(--colors-red-alpha-10)
--tag-border-neutral
var(--colors-neutral-600)
Dark mode var(--colors-neutral-300)
--tag-border-neutral-light
var(--colors-neutral-200)
Dark mode var(--colors-neutral-400)
--tag-border-oncolorvar(--colors-alpha-white-60)
--tag-border-success
var(--colors-green-700)
Dark mode var(--colors-green-400)
--tag-border-success-light
var(--border-success-light)
Dark mode var(--colors-green-400)
--tag-border-info
var(--colors-blue-700)
Dark mode var(--colors-blue-400)
--tag-border-info-light
var(--border-info-light)
Dark mode var(--colors-blue-400)
--tag-border-warning
var(--colors-yellow-700)
Dark mode var(--colors-yellow-400)
--tag-border-warning-light
var(--border-warning-light)
Dark mode var(--colors-yellow-400)
--tag-border-error
var(--colors-red-700)
Dark mode var(--colors-red-400)
--tag-border-error-light
var(--border-error-light)
Dark mode var(--colors-red-400)
--tag-dotvar(--colors-alpha-white-60)

It also reads these shared tokens. A change to one also changes other components.

Source: the var() reads in _sass/components/_tag.scss.

TokenPreviewValue
--text-oncolor-primaryvar(--colors-base-white)
Last Modified Date: 20/11/2026 - 07:56 PM
Was this page useful?
60% of users said Yes from 2843 Feedbacks