# KptBadge (kpt-badge) A badge - a counter or a status dot; standalone or overlaid on content (`overlay`). Import: `import { KptBadge } from '@konce-pt/angular';` ## Inputs - `value`: string|number|null; `variant`: 'neutral'|'primary'|'success'|'danger'|'warning'|'info' (default 'primary') - `size`: 'sm'|'md'|'lg' (default 'md') - height 1rem / 1.25rem / 1.5rem. The type size, the side inset and the dot diameter are derived from the height, so the proportions hold at every size. `sm` is meant for a badge sitting inside a line of text (a menu entry, a label, a table cell). - `dot`: boolean (a dot with no number); `overlay`: boolean (the corner of the content); `max`: number (default 99 -> '99+') - `label`: string - the meaning for screen readers ("3 unread", "online"); the visible text is then `aria-hidden` - `hideZero`: boolean - hides the badge when `value` is `0` or `null` (not with `dot`) ## Examples ## Tokens Background `--kpt-color-{primary,success,danger,warning,info}` with the text in the matching `*-contrast` token (`--kpt-color-on-primary` for `primary`) - the same pairs as `kpt-button`; `neutral` is `--kpt-color-muted` / `--kpt-color-on-muted`; the overlay ring comes from `--kpt-color-surface`. ## Accessibility On its own a badge is just a number, and a `dot` is nothing. `label` gives it a meaning - a visually hidden `.kpt-badge__label` that screen readers read instead of the visible text. Without `label`, put the meaning into the name of the control the badge sits on. Count changes are not announced. The `success`, `warning` and `info` variants draw the text in `--kpt-color-surface`; check the contrast in your theme, especially for `warning`.