Design System

Tag reference ​

Every prop, value, element and forwarded attribute on CTag. For what the component decides, see Overview. For how to write one, see Usage.

Imported as CTag from @proxy-frontend/components, with the types CTagSeverity, CTagCategory, CTagWidth and CTagProps.

Props ​

NameTypeRequiredDefaultMeaning
labelstring | numberYesNoneThe text in the chip. An empty string renders an empty label element rather than no element
iconstringNoAbsentThe class string of one icon, drawn in front of the label
severityCTagSeverityNoAbsentFills the chip from the intent ramp. Discarded when category is set
categoryCTagCategoryNoAbsentFills the chip from one accent group and adds a 1px border in that accent's line colour
widthCTagWidthNoAbsentPins the chip at a fixed width, with the label clipped to it

Events ​

NamePayload
NoneThe component declares no emits

A listener written at the call site is forwarded as an attribute and fires from the root element.

Slots ​

NameRendered
NoneThe component passes no slot content down, so the text comes from label alone

Vocabulary ​

AxisAcceptedDefault
severitycontrast, secondary, success, info, warn, dangerAbsent
categoryamber, azure, fern, lime, magenta, rust, teal, violetAbsent
widthsmall, mediumAbsent
variantNot accepted
sizeNot accepted

CTagSeverity is the shared Severity union unchanged, and CTagWidth is Size narrowed to its first two values. The shared axes are in components.

Severity colours ​

ValueBackgroundForeground
secondarybg-surface-hovertext-fg-default
successbg-surface-successtext-fg-success-strong
infobg-surface-infotext-fg-info-strong
warnbg-surface-warntext-fg-warn-strong
dangerbg-surface-dangertext-fg-danger-strong
contrastbg-fill-neutraltext-fg-on-neutral
AbsentNoneNone

Each category writes three classes in place of those two: bg-category-<name>-fill, border-category-<name>-line and text-category-<name>-fg, alongside border. The tokens are in colour.

DOM and ARIA ​

DepthElementRenderedAttributesClasses
1spanUnconditionallydata-pc-name="tag", data-pc-section="root"truncate, the preset root classes, and h-6, w-12, w-16, border and the three category classes where those props apply
2spanWhen icon is setdata-pc-section="icon"The icon string, plus mr-1 text-sm, or plus mr-0! when the label is empty
2spanUnconditionallydata-pc-section="label"None

The icon element is guarded, so a tag without one renders a comment placeholder in its position. The component sets inheritAttrs: false and name: "CTag", and writes no role and no aria-* of its own, so an aria-label from the call site lands on the root at depth 1.

Forwarded attributes ​

ShapeExamplesResult
data-*data-testid, data-tour-stepReaches the root
aria-*aria-label, aria-describedbyReaches the root
on followed by a capital@click, @keydownReaches the root
id, name, formidReaches the root
class, styleclass="ml-2"Removed, with nothing reported
title, role, tabindexrole="status"Outside the allow-list, so removed with the rest

The filter is useForwardedAttrs, shared with the other components that refuse attributes, and CTag passes no owns list, so nothing is held back from the root. Directives are not attributes and are not filtered, so v-tooltip reaches the root the way it would on any element.

Library sections ​

SectionPreset classResult
roottext-xs font-bold inline-flex items-center justify-center py-1 rounded-md, the side padding the preset sets in rem, and the background and foreground pair for the severity when one is setJoined with the classes the component adds
iconmr-1 text-smReplaced by mr-0! when an icon is set and the label is empty
valueleading-normalNot applied, because the section the library renders for the text is named label

With the value section unreached, the label takes its line box from text-xs on the root, which resolves to the caption role.

Measurements ​

ValueWhereSource
24pxHeight of a labelled tag at the 14px interface defaultThe 16px caption line box plus py-1 twice
21.72pxThe same tag at the smallest text setting of 12The line box moves with the root
26.27pxThe same tag against a 16px rootThe line box moves with the root
35.42pxThe same tag at the largest text setting of 24The line box moves with the root
26pxHeight of a category tag at the 14px defaultThe 1px border above and below
24pxHeight of a tag with an empty label and no iconh-6
48pxwidth="small"w-12 against --spacing: 4px
64pxwidth="medium"w-16 against --spacing: 4px
5.6pxSide padding at the 14px defaultSet in rem by the preset
6.4pxSide padding against a 16px rootSet in rem by the preset
4pxPadding above and below the labelpy-1
4pxGap between the glyph and the labelmr-1
0pxThe same gap when the label is emptymr-0!
6pxCornerrounded-md, aliased to --radius
600Label weightfont-bold, resolving to --font-weight-bold
5.25Contrast of text-fg-on-neutral on bg-fill-neutral, in both appearancesseverity="contrast"

The text size setting is in type, and the contrast floors are in colour.

ComponentDifference
CButtonTakes focus, fires an event and draws hover and active states, with variant="text" as its quietest form
CToastCarries a severity of its own, chosen by which function is called rather than by a prop, and holds error where this one holds danger

Tests ​

AssertionPinned value
A tag that reserves a width stays visible with an empty labelComputed visibility of visible
An icon-only tag drops the gap beside the glyphThe icon class contains mr-0!
A tag with a label keeps that gapThe icon class does not contain mr-0!