ngx-prompt-kit

Usage Card

ngx-prompt-kit original — not part of ibelick/prompt-kit

Persistent session/account-level usage indicator. Three display modes — ring (Instagram/Discord pattern, usage IS the chrome), inline (sidebar header row), and card (standalone block, JetBrains AI widget pattern). All share threshold colors at 75/90/100% and identity-integrated by design.

Examples

Ring — identity-integrated

Default mode. Circular SVG arc wraps the avatar; name + sublabel stack to the right. Most compact mode — hover for the full readout.

Niclas
NiclasPro plan

Inline — sidebar header row

Horizontal layout for sidebar headers. Avatar + name + sublabel + readout on top, fill bar below. Numbers visible at a glance — use this when ring is too small for the readout to be useful.

Niclas
NiclasResets in 12 days
30,000 / 50,000 · 60%

Card — standalone block with top-up

Full hlm-card chrome, label header, fill bar, count, optional Top-up button. The button only renders when [topUpLabel] is set — no dead CTAs. 88% usage trips the amber threshold.

Niclas
NiclasPro plan
Token usage 44,000 / 50,000 · 88%

Threshold trio — ring colors at 30 / 85 / 105 %

Three rings side-by-side at the muted, amber, and destructive thresholds. Easiest way to verify the traffic-light state in both themes.

Avatar
30%
Avatar
85%
Avatar
105%

Monochrome — opt out of threshold colors

Set [monochrome]='true' to drop the traffic-light entirely. Ring stroke, bar fill, and number text all use the foreground color (near-white in dark, near-black in light). Useful when usage is informational rather than actionable — no warning state needed.

Avatar
30%
Avatar
85%
Avatar
105%

Installation

Add the usage-card component (and the cn() utility) to your project.

ng generate ngx-prompt-kit:usage-card

Component API

PkUsageCard

PropTypeDefaultDescription
usednumberCurrent usage value (required).
limitnumber | nullCap. Required prop, but null/0 degrades gracefully — bar/ring hide and the readout shows just the used count + unit.
display"ring" | "inline" | "card" "ring" ring: SVG arc wrapping the avatar (most compact). inline: sidebar header row with bar + readout. card: standalone hlm-card with label, bar, count, optional top-up.
avatarstring?Image URL or data URI; falls back to initials.
namestring?Display name. Drives initials fallback when avatar is absent.
sublabelstring?Smaller muted line under name — plan tier, reset window, etc.
labelstring "Usage" Used in card mode header, tooltip, and aria-label.
unitstring "tokens" Trailing unit when the bar is hidden (limit unset).
showPercentageboolean true Append "· N%" to the readout.
localestring?BCP-47 locale for Intl.NumberFormat. Defaults to runtime locale.
ringSizenumber 40 Ring + avatar diameter in px (ring mode only).
ringStrokenumber 2.5 Ring stroke width in px (ring mode only).
topUpLabelstring | null null Card mode only. Set to a label string to render the Top-up button. Null hides it entirely — no dead CTA when consumers haven't wired anything.
classstringExtra classes for the host.

Outputs

PropTypeDefaultDescription
topUpClicked() => voidFires when the Top-up button is clicked. Only emits if topUpLabel is set (button is rendered).