CngxCardBadge
projects/common/card/card-badge.directive.ts
Import#
import { CngxCardBadge } from '@cngx/common/card'
Description#
Positions a badge element at a corner of its parent card and projects intent + size variants onto the host class so a bare element renders a usable pill without any inline styles.
<cngx-card>
<span cngxCardBadge position="top-end" intent="danger" size="md">P</span>
<header cngxCardHeader>Pflegeplan</header>
</cngx-card>Empty content collapses to a fixed-diameter dot via :empty (status
indicator pattern). Theme via the --cngx-card-badge-* tokens on
card.component.css; fallbacks chain through --cngx-badge-* then
the foundation palette.
Metadata#
Host#
Index#
HostBindings
Inputs#
"primary" | "danger" | "warning" | "success" | "neutral"Tone of the badge surface. Resolves to
--cngx-card-badge-<intent>-bg / -color; cascades through
--cngx-badge-<intent>-bg then --cngx-color-<system>.
'primary'"top-start" | "top-end" | "bottom-start" | "bottom-end"Corner position using logical properties.
'top-end'"sm" | "md" | "lg"Pill diameter and font-size. Empty content always renders as a
fixed dot at the sm token regardless of this input (:empty
fallback for status indicators).
'md'HostBindings#
| Binding | Expression |
|---|---|
[class.cngx-card__badge--top-start] | position() === "top-start" |
[class.cngx-card__badge--top-end] | position() === "top-end" |
[class.cngx-card__badge--bottom-start] | position() === "bottom-start" |
[class.cngx-card__badge--bottom-end] | position() === "bottom-end" |
[class.cngx-card__badge--intent-primary] | intent() === "primary" |
[class.cngx-card__badge--intent-danger] | intent() === "danger" |
[class.cngx-card__badge--intent-warning] | intent() === "warning" |
[class.cngx-card__badge--intent-success] | intent() === "success" |
[class.cngx-card__badge--intent-neutral] | intent() === "neutral" |
[class.cngx-card__badge--size-sm] | size() === "sm" |
[class.cngx-card__badge--size-md] | size() === "md" |
[class.cngx-card__badge--size-lg] | size() === "lg" |