Skip to main content

CnStatusBadge

Color-coded pill badge for status, priority, or category display. Supports automatic variant resolution via colorMap.

Try it​

Loading CnStatusBadge playground…

Props​

CnStatusBadge showing colored status indicators

PropTypeDefaultDescription
labelString''Display text
variantString'default''default', 'primary', 'success', 'warning', 'error', 'info'
sizeString'medium''small' or 'medium'
solidBooleanfalseUse solid background with white text instead of light background with colored text
colorMapObjectnullMap label values to variants (case-insensitive)
colorKeyString''Look this up in colorMap instead of the label. Use it when the label is translated but the map is keyed on the raw value (e.g. a schema enum code) — otherwise a translated label matches nothing and the badge falls back to variant.

Slots​

SlotDescription
defaultCustom label content
#iconIcon element displayed before the label text

Usage​

<!-- Manual variant -->
<CnStatusBadge label="Active" variant="success" />

<!-- Solid variant — for use on colored backgrounds -->
<CnStatusBadge label="Active" variant="success" :solid="true" />

<!-- Auto-resolved from colorMap -->
<CnStatusBadge
:label="contact.status"
:colorMap="{
active: 'success',
inactive: 'error',
lead: 'warning',
prospect: 'info',
}" />

Reference (auto-generated)​

The tables below are generated from the SFC source via vue-docgen-cli. They reflect what's actually in CnStatusBadge.vue and update automatically whenever the component changes.

Props​

NameTypeRequiredDefaultDescription
labelstring''Badge label text
variantstring'default'Color variant: 'default', 'primary', 'success', 'warning', 'error', 'info'
sizestring'medium'Size: 'small' or 'medium'
solidbooleanfalseUse solid background with white text instead of light background with colored text. Useful when the badge is placed on a colored background (e.g., an active card).
colorMapobjectnullMap of label values to variants. When provided, the variant is resolved from this map using the label (case-insensitive). Falls back to the variant prop. { open: 'success', closed: 'default', overdue: 'error' }
colorKeystring''Key to look up in colorMap instead of the label. Set this when the label is a translated/display string but the map is keyed on the raw value (e.g. a schema enum code) — without it a translated label misses every map entry and the badge silently falls back to variant.

Slots​

NameBindingsDescription
default—
icon—