Skip to content
DGA UI

Tag

Labels for categories, filters and statuses. Tag and Status Tag, filled or outlined, three sizes, optionally removable.

On this page

Tags label content by category or show the filters a user has picked. Status tags show the state of an item, task or request.

Tag
tag-variants-direction
tag-variants-theme
tag-variants-viewport
Mobile · 375px

Installation

npx shadcn@latest add @dga/tag

Usage

page.tsx
import { StatusTag, Tag } from "@/components/ui/tag";

<Tag variant="info">تقنية</Tag>
<StatusTag variant="success">مكتمل</StatusTag>

Removable

Pass onDismiss to add a close button. Give it a specific name with dismissLabel, such as "إزالة الرياض", so screen-reader users know which filter it removes. Move focus to a sensible place after the tag is removed (for example the next tag or the filter field).

Removable
tag-dismiss-direction
tag-dismiss-theme
tag-dismiss-viewport
Mobile · 375px

Status Tag

subtle (default) sits on a tint, inverted on a solid fill and ghost has no fill. All three start with a coloured dot.

Status Tag
status-tags-direction
status-tags-theme
status-tags-viewport
Mobile · 375px

Props

Tag

Prop

Type

StatusTag

Prop

Type

Accessibility

  • Tags are <span>s and are read as text. Put the meaning in the label; the colour and dot are extras (WCAG 1.4.1).
  • The close button is a real <button> with its own name and a 24px hit area (WCAG 2.5.8).
  • Use Button with aria-pressed for tags the user can toggle on and off.

Contrast

248 pairs checked against WCAG 2.1 AA (text 4.5:1, icons and focus rings 3:1), all passing. Disabled states are exempt.

neutral
StateForeground on backgroundLightDark
filledtag-text-neutral / tag-background-neutral-light13.91:1 AAA13.20:1 AAA
filled (icon)icon-default / tag-background-neutral-light17.31:1 3:114.53:1 3:1
outlinedtag-text-neutral / background-white13.91:1 AAA13.20:1 AAA
outlined (icon)icon-default / background-white17.31:1 3:114.53:1 3:1
status neutral
StateForeground on backgroundLightDark
subtletag-text-neutral / tag-background-neutral-light13.91:1 AAA13.20:1 AAA
ghosttag-text-neutral / background-white13.91:1 AAA13.20:1 AAA
ghost (dot)icon-default / background-white17.31:1 3:114.53:1 3:1
invertedtext-oncolor-primary / tag-background-neutral7.36:1 AAA7.36:1 AAA
success
StateForeground on backgroundLightDark
filledtag-text-success / tag-background-success-light7.55:1 AAA6.63:1 AA
filled (icon)tag-icon-success / tag-background-success-light7.55:1 3:16.63:1 3:1
outlinedtag-text-success / background-white7.62:1 AAA7.17:1 AAA
outlined (icon)tag-icon-success / background-white7.62:1 3:17.17:1 3:1
status success
StateForeground on backgroundLightDark
subtletag-text-success / tag-background-success-light7.55:1 AAA6.63:1 AA
ghosttag-text-neutral / background-white13.91:1 AAA13.20:1 AAA
ghost (dot)tag-icon-success / background-white7.62:1 3:17.17:1 3:1
invertedtext-oncolor-primary / tag-background-success5.69:1 AA5.69:1 AA
info
StateForeground on backgroundLightDark
filledtag-text-info / tag-background-info-light7.61:1 AAA5.83:1 AA
filled (icon)tag-icon-info / tag-background-info-light7.61:1 3:15.83:1 3:1
outlinedtag-text-info / background-white7.83:1 AAA6.28:1 AA
outlined (icon)tag-icon-info / background-white7.83:1 3:16.28:1 3:1
status info
StateForeground on backgroundLightDark
subtletag-text-info / tag-background-info-light7.61:1 AAA5.83:1 AA
ghosttag-text-neutral / background-white13.91:1 AAA13.20:1 AAA
ghost (dot)tag-icon-info / background-white7.83:1 3:16.28:1 3:1
invertedtext-oncolor-primary / tag-background-info4.56:1 AA4.56:1 AA
warning
StateForeground on backgroundLightDark
filledtag-text-warning / tag-background-warning-light7.20:1 AAA7.41:1 AAA
filled (icon)tag-icon-warning / tag-background-warning-light7.20:1 3:17.41:1 3:1
outlinedtag-text-warning / background-white7.19:1 AAA7.89:1 AAA
outlined (icon)tag-icon-warning / background-white7.19:1 3:17.89:1 3:1
status warning
StateForeground on backgroundLightDark
subtletag-text-warning / tag-background-warning-light7.20:1 AAA7.41:1 AAA
ghosttag-text-neutral / background-white13.91:1 AAA13.20:1 AAA
ghost (dot)tag-icon-warning / background-white7.19:1 3:17.89:1 3:1
invertedtext-oncolor-primary / tag-background-warning5.42:1 AA5.42:1 AA
error
StateForeground on backgroundLightDark
filledtag-text-error / tag-background-error-light7.96:1 AAA5.06:1 AA
filled (icon)tag-icon-error / tag-background-error-light7.96:1 3:15.06:1 3:1
outlinedtag-text-error / background-white8.29:1 AAA5.21:1 AA
outlined (icon)tag-icon-error / background-white8.29:1 3:15.21:1 3:1
status error
StateForeground on backgroundLightDark
subtletag-text-error / tag-background-error-light7.96:1 AAA5.06:1 AA
ghosttag-text-neutral / background-white13.91:1 AAA13.20:1 AAA
ghost (dot)tag-icon-error / background-white8.29:1 3:15.21:1 3:1
invertedtext-oncolor-primary / tag-background-error4.83:1 AA4.83:1 AA
on-color
StateForeground on backgroundLightDark
filledtext-oncolor-primary / tag-background-on-color6.30:1 AA6.30:1 AA
outlinedtext-oncolor-primary / background-primary4.74:1 AA4.74:1 AA

Deviations from DGA

ItemDGA originalOursReason
--tag-background-on-color (light)--colors-alpha-alpha-white-20--colors-alpha-alpha-black-20White label on white-20 over the brand fill is 3.34:1. A black-20 tint keeps the tag visible and gives 6.30:1.
--tag-background-on-color (dark)--colors-alpha-alpha-white-20--colors-alpha-alpha-black-20White label on white-20 over the brand fill is 3.34:1. A black-20 tint keeps the tag visible and gives 6.30:1.
Tag: text sizeText 2xs/SemiBold on every size in the exported variant tableText sm (md, 32px), Text xs (sm, 24px) and Text 2xs (xs, 20px), SemiBoldThe export lists one sample text style. A 10px label in a 32px tag is hard to read; the sizes follow the site CSS (.tag--lg uses 14px).
Tag: dismissOptional trailing icononDismiss adds a trailing close button (Cancel icon) with an aria-label (dismissLabel). The tag itself is not interactive.Removable filter tags need a real button for keyboard and screen-reader users.
Status Tag: ghost and dotGhost: neutral label with no fillEvery status tag starts with a coloured dot (tag-icon-*; tag-dot on inverted) so ghost tags still show their colour.Ghost tags would otherwise all look the same; the dot is decorative and the label carries the status.
Edit this page on GitHub (opens in a new tab)