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.
import { TagComponent } from '@guildofgleks/ui';
@Component({
// ...
imports: [TagComponent],
})
Basic usage — a status label with a leading icon:
<gog-tag variant="success" iconName="success">Paid</gog-tag>
<gog-tag variant="warning" iconName="clock">Due in 3 days</gog-tag>Examples
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.
@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
<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.
<!-- 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-hiddenwhichever 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
| Name | Type | Default | Description |
|---|---|---|---|
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. |
iconName | GogIconName | null | null | Leading icon. |
fullWidth | boolean | false | By default the tag fits its text with no wrapping. Set true to stretch it to fill its container instead. |
Content slots
| Directive | Context | Description |
|---|---|---|
(default) | — | The tag's text. |
gogTagIcon | none | An <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.
| Token | Description |
|---|---|
--gog-tag-default-color / -success-color / -danger-color / -warning-color / -info-color | Base color per semantic variant. |
--gog-tag-bg-base / -color-base / -bg-mix / -color-mix | How the variant color is mixed into background and text. |
--gog-tag-radius / -pill-radius | Corner radius, square and pill shape. |
--gog-tag-{size}-font-size / -padding-block / -padding-inline / -gap / -icon-size | Full sizing scale, per size step (xsm/sm/md/lg/slg). |