Skip to main content

lib-status-badge

lib-status-badge is the state-aware version of lib-badge.

It already knows the common execution states used in this repo, maps them to icons, and formats the label.

Import

import {
StatusBadeType,
StatusBadgeComponent,
} from '@shared-lib/components/status-badge/status-badge.component';

Supported types

  • SUCCESS
  • FAILED
  • RUNNING
  • PENDING
  • WARNING
  • INIT
  • STOPPED

Inputs

InputTypeDefaultNotes
typeStatusBadeTypenoneDrives color and icon
textstringnoneOptional override text
size'X-SMALL' | 'SMALL' | 'MEDIUM' | 'LARGE''MEDIUM'Badge size
animatebooleantrueUsually keep this on for live states
noTextbooleanfalseIcon-only variant
widthnumber | nullnullFixed width in pixels
borderbooleanfalseBorder variant

Default usage

<lib-status-badge
[type]="projectStatusToBadgeStatus(experiment().experimentStatus!)"
[text]="experiment().experimentStatus!"
size="SMALL"
/>

Practical notes

  • Prefer type even if you also pass text. The type gives you the right icon and color.
  • Pass text when the backend value is worth showing directly.
  • Use noText only when the surrounding layout already explains the state.

When to choose this over lib-badge

Pick lib-status-badge when the value is a real system state. Pick lib-badge when it is just a tag.