GUILD OF GLEKS UIv21.19.0

gog-tag

Tag

An informational status label with four semantic variants, two shapes, five sizes, and width that follows the text without wrapping by default.

Overview

Import the component and drop it into a template.

typescript
import { TagComponent } from '@guildofgleks/ui';

@Component({
  // ...
  imports: [TagComponent],
})

Basic usage — a status label with a leading icon:

PaidDue in 3 days
<gog-tag variant="success" iconName="success">Paid</gog-tag>
<gog-tag variant="warning" iconName="clock">Due in 3 days</gog-tag>

Examples

Variants and sizes

Four status colours at each of five sizes. Every surface — the fill, the border, the text — is mixed from one colour per variant, so the four read as one family in every theme. The colour is a hint, never the message: the text has to say "Paid" or "Overdue" on its own, for anyone who cannot tell green from red. A tag has no interactive states.

size: xsm info success warning danger
size: sm info success warning danger
size: md info success warning danger
size: lg info success warning danger
size: slg info success warning danger
@for (size of sizes; track size) {
  <div>
    <span>size: {{ size }}</span>
    @for (variant of variants; track variant) {
      <gog-tag [size]="size" [variant]="variant" [iconName]="variantIcons[variant]">
        {{ variant }}
      </gog-tag>
    }
  </div>
}

Shapes and icons

rounded (the default) or pill, without an icon, with iconName — any built-in or registered name — and with a gogTagIcon template, which replaces the icon with any markup and wins when both are set. The icon is sized from the tag's own scale, not from --gog-icon-size.

shape="rounded"PaidPaid Due in 3 days
shape="pill"PaidPaid Due in 3 days
@for (shape of shapes; track shape) {
  <div>
    <span>shape="{{ shape }}"</span>
    <gog-tag [shape]="shape" variant="success">Paid</gog-tag>
    <gog-tag [shape]="shape" variant="success" iconName="success">Paid</gog-tag>
    <!-- The template replaces the icon with any markup, and wins over iconName. -->
    <gog-tag [shape]="shape" variant="warning">
      <ng-template gogTagIcon><gog-icon name="clock" /></ng-template>
      Due in 3 days
    </gog-tag>
  </div>
}

Width

A tag fits its text and never wraps: two words of a status splitting across lines reads as two tags. fullWidth stretches it across its container — the dashed box — text centred. Text longer than its room ends in an ellipsis inside the border 21.15.0. A screen reader still reads it in full, but a sighted reader loses it, so keep a status short or show the whole of it somewhere else.

fits its textfullWidth Awaiting a sign-off from the regional finance team before release
<gog-tag variant="info">fits its text</gog-tag>
<gog-tag variant="info" fullWidth>fullWidth</gog-tag>
<!-- Longer than its room: an ellipsis inside the border; a screen reader still reads it all. -->
<gog-tag variant="warning" iconName="clock">
  Awaiting a sign-off from the regional finance team before release
</gog-tag>

A colour outside the four — --gog-tag-accent

The four variants cover status. For a category — a team, a label colour a user picked — set --gog-tag-accent on the tag and the fill, border and text are all derived from it the same way. Check the contrast of a colour you bring: the library's own four are measured in every theme, and yours is not.

DesignPlatformResearch
<!-- One colour in, and the fill, border and text are derived from it. -->
<gog-tag style="--gog-tag-accent: #7c5cdb">Design</gog-tag>
<gog-tag style="--gog-tag-accent: #1f8a80">Platform</gog-tag>
<gog-tag style="--gog-tag-accent: #c2417c" shape="pill">Research</gog-tag>

Accessibility

A tag is text in a coloured box. It has no role and no name of its own, and its icon is decorative.

  • Host — no ARIA at all, so a screen reader reads the tag's text where it stands, as it would any span.
  • Icon — aria-hidden whichever way it was given, so an icon cannot be the only thing that says what a tag means.
  • Changes — a tag that must interrupt, like a status that changes while the page is open, needs a live region around it; gog-alert is the component for a message that has to be heard.
  • Keyboard — none. A tag is not focusable.
  • Tag, chip or badge — a tag labels something and does nothing when pressed. A chip is something to press, toggle or remove. A badge is a count pinned to the corner of another control. If a tag starts needing a click handler, it has become a chip.

API Reference

Inputs

NameTypeDefaultDescription
variant'success' | 'danger' | 'warning' | 'info''info'Semantic color.
size'xsm' | 'sm' | 'md' | 'lg' | 'slg''md'Font size, padding, gap, and icon size.
shape'rounded' | 'pill''rounded'Corner radius style.
iconNameGogIconName | nullnullLeading icon.
fullWidthbooleanfalseBy default the tag fits its text with no wrapping. Set true to stretch it to fill its container instead.

Content slots

DirectiveContextDescription
(default)—The tag's text.
gogTagIconnoneAn <ng-template> that replaces the leading icon. Wins over iconName.

Global Configuration

This component has no GOG_CONFIG entries of its own — every default is set per instance. See Global Configuration for what does apply app-wide.

Styling Tokens

Every CSS custom property the tag paints with. Override any of them — on a single instance, a subtree, or a theme — to restyle it. See the Theming guide for the full token-layering model, or the Theme Generator to tweak these live.

TokenDescription
--gog-tag-default-color / -success-color / -danger-color / -warning-color / -info-colorBase color per semantic variant.
--gog-tag-bg-base / -color-base / -bg-mix / -color-mixHow the variant color is mixed into background and text.
--gog-tag-radius / -pill-radiusCorner radius, square and pill shape.
--gog-tag-{size}-font-size / -padding-block / -padding-inline / -gap / -icon-sizeFull sizing scale, per size step (xsm/sm/md/lg/slg).