Component

Badge

A small label for a status, count, or category. Use hb-badge inline, or hb-overlay-badge to pin a count or dot to the corner of another element.

Types

DefaultSecondary LiveFadingDiscardedOutline
import { ChangeDetectionStrategy, Component } from '@angular/core';

import { NgIcon, provideIcons } from '@ng-icons/core';
import { phosphorCheckCircle } from '@ng-icons/phosphor-icons/regular';

import { HbBadgeImports } from '@herbst/ui';

@Component({
  selector: 'hb-demo-badge-types',
  imports: [HbBadgeImports, NgIcon],
  providers: [provideIcons({ phosphorCheckCircle })],
  template: `
    <div class="flex flex-wrap items-center gap-2">
      <span hb-badge>Default</span>
      <span hb-badge hbType="secondary">Secondary</span>
      <span hb-badge hbType="success"><ng-icon name="phosphorCheckCircle" /> Live</span>
      <span hb-badge hbType="warning">Fading</span>
      <span hb-badge hbType="destructive">Discarded</span>
      <span hb-badge hbType="outline">Outline</span>
    </div>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HbDemoBadgeTypesComponent {}

Shapes

roundedpillsquare3

Sizes

xssmmdlgxl

Overlay badge

5 99

API reference

hb-badge

PropertyDescriptionTypeDefault
[hbType] Colour intent of the badge. 'default' | 'secondary' | 'destructive' | 'success' | 'warning' | 'outline' 'default'
[hbShape] Corner style; circle and square suit single characters. 'rounded' | 'pill' | 'circle' | 'square' 'pill'
[hbSize] Overall scale of the badge. 'xs' | 'sm' | 'md' | 'lg' | 'xl' 'md'
[class] Extra CSS classes merged onto the host. Projected content (text or icon) fills the badge. string ''

hb-overlay-badge

PropertyDescriptionTypeDefault
[hbValue] Count or text shown in the corner badge. string | number | null null
[hbDot] Show a plain dot instead of the value. boolean false
[hbType] Colour intent of the corner badge. 'default' | 'secondary' | 'destructive' | 'success' | 'warning' | 'outline' 'destructive'
[hbPosition] Corner the badge is pinned to. 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' 'top-right'
[hbSize] Scale of the corner badge. 'xs' | 'sm' | 'md' | 'lg' | 'xl' 'sm'