Skip to content
Sign upGet access
MicrointeractionsCredit spendMenu

Credit spend (Pro)

ProIncluded in $99

Credits you can see spent: the cost breaks off the bar and flies to what it paid for.

ProEach generation breaks its cost off the end of the credits bar; the piece flies to the take it paid for and lands as the price.

The balance is a bar and a number. When something costs credits, the piece of the bar it costs breaks off the end, flies to the thing it paid for and turns into the price as it lands, while the bar closes up and the number counts down. Below a tenth of the allowance the bar turns amber.

Installation

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

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 { CreditSpend, spendFrom } from "@/components/ui/chatcn/pro/credit-spend"

await spendFrom(meter, tile, 160, balance, allowance)
setBalance((b) => b - 160)

<CreditSpend ref={meterRef} balance={balance} allowance={2000} />

Props

PropTypeNotes
balance / allowancenumber
labelstringDefault "Credits"

Accessibility

  • A labelled meter; the flying piece is decorative.

Motion

  • The piece arcs 620 ms and widens into the price; the bar closes on a spring. Reduced motion: no flight.