Angular Badges Library | ng-hub-ui-badges

Semantic Angular badges for statuses, counters and removable filter tags, with CSS variables and public SCSS mixins for custom colour families.

Styles

Mixins and styles

Override the key `--hub-badge-*` design tokens in a single include. Every parameter is OPTIONAL and defaults to `null`: only the parameters you pass are emitted, so the rest keep the component defaults. Token-based and self-contained.

Theming with hub-badge-theme
DefaultSoftOutline
ThemedThemed softThemed outline
MixinParametersDescription
Theming
hub-badge-theme()
$accent--hub-badge-accent
$bg--hub-badge-bg
$color--hub-badge-color
$border-color--hub-badge-border-color
$border-radius--hub-badge-border-radius
$border-width--hub-badge-border-width
$padding-x--hub-badge-padding-x
$padding-y--hub-badge-padding-y
$gap--hub-badge-gap
$font-size--hub-badge-font-size
$font-weight--hub-badge-font-weight
One-call token theming for `<hub-badge>` (and `<hub-chip>`)

CSS variables

Theme every pixel with 49 CSS variables. Override them at :root or scope them to a wrapper.

Badge

Design tokens read by this component. Override them on the host element (or any ancestor) to customize; every default falls back to the ng-hub-ui-ds layer.

VariableDefaultTypeDescription
--hub-badge-accentvar(--hub-sys-color-primary, #0d6efd)color Root semantic accent from which the badge derives its look.
--hub-badge-accent-bordercolor-mix(in oklch, var(--hub-badge-accent) 35%, var(--hub-sys-surface-page, #fff))color Border role used by subtle and surface variants.
--hub-badge-accent-onoklch(from var(--hub-badge-accent) clamp(0, (0.62 - l) * 1000, 1) 0 h)color Badge accent contrast (on-color)
--hub-badge-accent-emphasiscolor-mix(in oklch, var(--hub-badge-accent) 80%, var(--hub-sys-color-ink, #212529))color Emphasis foreground used by outline, ghost and soft variants.
--hub-badge-accent-subtlecolor-mix(in oklch, var(--hub-badge-accent) 12%, var(--hub-sys-surface-page, #fff))color Tinted surface used by soft and subtle variants.
--hub-badge-aligncenterstring Cross-axis alignment of the badge content.
--hub-badge-bgvar(--hub-badge-accent)color Badge bg
--hub-badge-border-colorvar(--hub-badge-accent)color Badge border color
--hub-badge-border-radiusvar(--hub-ref-radius-pill, 50rem)length Corner radius of the badge shell.
--hub-badge-border-widthvar(--hub-ref-border-width, 1px)length Badge border width
--hub-badge-colorvar(--hub-badge-accent-on)color Badge color
--hub-badge-directionrowstring Flex direction of the badge content (projected icon, label and dismiss button).
--hub-badge-dot-colorcurrentColorcolor Badge dot color
--hub-badge-dot-sizevar(--hub-ref-space-2, 0.5rem)length Diameter of the optional status dot.
--hub-badge-focus-ring-colorvar(--hub-sys-focus-ring-color, rgba(13, 110, 253, 0.25))color Badge focus ring color
--hub-badge-focus-ring-widthvar(--hub-sys-focus-ring-width, 0.25rem)length Badge focus ring width
--hub-badge-font-familyvar(--hub-ref-font-family-base, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif)string Badge font family
--hub-badge-font-sizevar(--hub-ref-font-size-sm, 0.875rem)length Base font size of the badge shell.
--hub-badge-max-width100%length Maximum badge width before the label is truncated with an ellipsis.
--hub-badge-font-weightvar(--hub-ref-font-weight-semibold, 600)number Badge font weight
--hub-badge-gapvar(--hub-ref-space-1, 0.25rem)length Gap between dot, icons, label and remove button.
--hub-badge-letter-spacing0.01emlength Badge letter spacing
--hub-badge-line-height1number Badge line height
--hub-badge-padding-xvar(--hub-ref-space-2, 0.5rem)length Horizontal padding inside the badge shell.
--hub-badge-padding-yvar(--hub-ref-space-1, 0.25rem)length Vertical padding inside the badge shell.
--hub-badge-remove-gap0.125remlength Badge remove gap
--hub-badge-remove-hover-bgcolor-mix(in oklch, currentColor 12%, transparent)color Hover surface of the dismiss affordance.
--hub-badge-remove-size1remlength Size of the dismiss hit area.
--hub-badge-transitionvar(--hub-sys-transition-base, all 0.2s ease-in-out)transition Badge transition
--hub-badge-active-bgvar(--hub-badge-accent-emphasis)color Active (pressed) background of an interactive badge (.hub-badge--active)
--hub-badge-overlay-offset-0.25remlength Corner inset of the overlay status dot (dotOverlay)
--hub-chip-set-gapvar(--hub-ref-space-2, 0.5rem)length Gap between chips inside a hub-chip-set
--hub-chip-transitionvar(--hub-sys-transition-base, all 0.2s ease-in-out)transition Chip transition
--hub-chip-focus-ring-widthvar(--hub-sys-focus-ring-width, 0.25rem)length Chip focus ring width
--hub-chip-border-radiusvar(--hub-ref-radius-pill, 50rem)length Chip shell radius
--hub-chip-border-widthvar(--hub-ref-border-width, 1px)length Chip border width
--hub-chip-padding-yvar(--hub-ref-space-1, 0.25rem)length Chip vertical padding
--hub-chip-padding-xvar(--hub-ref-space-2, 0.5rem)length Chip horizontal padding
--hub-chip-font-weightvar(--hub-ref-font-weight-medium, 500)number Chip font weight
--hub-chip-font-sizevar(--hub-ref-font-size-sm, 0.875rem)length Chip font size
--hub-chip-font-familyvar(--hub-ref-font-family-base, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif)string Chip font family
--hub-chip-focus-ringvar(--hub-sys-focus-ring-color, rgba(13, 110, 253, 0.25))color Chip focus ring colour
--hub-chip-gapvar(--hub-ref-space-1, 0.25rem)length Gap between leading slot, label and dismiss button
--hub-chip-hover-bgcolor-mix(in oklch, var(--hub-badge-accent) 20%, var(--hub-sys-surface-page, #fff))color Hover surface for an unselected, enabled chip
--hub-chip-selected-colorvar(--hub-badge-accent-on)color Selected chip text colour (on-accent contrast)
--hub-chip-selected-bgvar(--hub-badge-accent)color Selected chip background
--hub-chip-border-colorvar(--hub-badge-accent-border)color Resting chip border colour
--hub-chip-colorvar(--hub-badge-accent-emphasis)color Resting chip text colour
--hub-chip-bgvar(--hub-badge-accent-subtle)color Resting chip background (shared badge accent family)