Skip to content
Sign upPro
BillingLow credit bannerMenu

Low credit banner (Pro)

ProIncluded in $99

A warning before credits run out, in days at the real pace, with the way out right beside it, or one quiet line above the composer.

ProA warning in days at the real pace, with top up and auto top up beside it.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/low-credit-banner

Needs chatcn Pro

This command works with a Pro license, along with every Pro component.

Or start free: sign up and get three Pro components on us, with a new one every month.

Usage

tsx
import { LowCreditBanner } from "@/components/ui/chatcn/pro/low-credit-banner"

<LowCreditBanner
  remaining={balance}
  total={plan.credits}
  daysLeft={daysLeftAtPace(balance, creditsPerDay)}
  onTopUp={openTopUp}
  onAutoTopUp={openAutoTopUp}
  onDismiss={snooze}
/>

<LowCreditBanner variant="inline" remaining={balance} total={plan.credits} daysLeft={days} onTopUp={openTopUp} />

Days at the pace you actually use credits mean more than a raw count, so that is the headline; the count sits under it and a thin bar shows what is left of a full balance. Amber while there is time, red once replies stop, and the red state cannot be dismissed. Top up is always there; turning on automatic top ups is offered beside it when you pass onAutoTopUp. The inline variant is a single line for above a composer: gray with no icon while there is time, amber with an icon below warnBelow days, red once replies stop, so it can stay on screen all the time without nagging.

Examples

States

ProAbout a week left, less than a day left, and out of credits with replies paused.

Props

PropTypeNotes
remaining, totalnumberBalance and a full balance, for the bar
daysLeftnumberAt the recent pace. See daysLeftAtPace
unitstringDefault credits
onTopUp, onAutoTopUp, onDismiss() => voidEach shows its button
variant"banner" | "inline"Default banner
warnBelownumberInline only. Days below which it turns amber. Default 3
locale, labelsFormatting and every string

Accessibility

  • A status while there is time, an alert once replies are paused.
  • The inline line truncates instead of wrapping and drops its bar on a phone; the sentence always stays.
  • Every color comes with an icon and the sentence that says what it means.

Motion

The inline bar eases to the new balance in 300 ms; nothing moves with reduced motion.