Skip to content
Sign in
Image studioBatch stepperMenu

Batch stepperPro

Images per run, 1 to 8, with run slots and a total credit cost whose digits roll, amber with a top up link when the run costs more than the balance.

ProImages per run with the total cost rolling as the count changes.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/batch-stepper

Usage

tsx
import { BatchStepper } from "@/components/ui/chatcn/pro/batch-stepper"

<BatchStepper value={count} onValueChange={setCount} creditsPerImage={3} balance={credits} />

Slots the balance cannot pay for are outlined in amber, so the limit is visible before the total turns. RollingDigits is exported for your own counters.

Examples

States

ProOver the balance, at the maximum, compact and disabled.

Props

PropTypeNotes
value, defaultValue, onValueChangenumberDefault 1
min, maxnumberDefault 1 and 8
creditsPerImagenumberDefault 1
balance, onTopUpAmber with a top up link when short
variant"default" | "compact"Compact is the stepper alone
label, units, locale, disabled

Keyboard

KeyAction
↑ → +One more image
↓ ← -One fewer
1 to 8Jump to that count
Home, EndMinimum or maximum
Page Up, Page DownFour more or fewer

Accessibility

  • A spinbutton whose value text includes the cost: "4 images, 12 credits". The minus and plus buttons stay out of the tab order.
  • Going over the balance is announced with how many credits are left.

Motion

  • After a click each changed digit rolls on its own column in 280 ms. Keyboard changes and the first render swap at once; reduced motion always swaps.