Skip to content
Sign in
VideoDuration pickerMenu

Duration pickerPro

5 s, 10 s or a custom length, each with its credit cost. Lengths the model cannot render are off with the model's range in words, and the custom slider stays inside it.

Pro5 s, 10 s or a custom length, each with its cost, and the balance after.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/duration-picker

Usage

tsx
import { DurationPicker } from "@/components/ui/chatcn/pro/duration-picker"

<DurationPicker
  value={seconds}
  onValueChange={setSeconds}
  limits={{ minSeconds: 2, maxSeconds: 8, creditsPerSecond: 4 }}
  balance={credits}
/>

Under the options, the price of the current choice and the balance after, or how many credits are missing. Custom lengths snap to limits.step. The file also exports VideoRange, the native range input over a drawn track the video controls share.

Examples

States

A model capped at 8 s, a custom length, a short balance, three presets without custom, disabled and right to left.

ProA model capped at 8 s, a custom length, a short balance, three presets without custom and disabled.

Props

PropTypeNotes
value, defaultValue, onValueChangenumberSeconds
presetsnumber[]Default 5 and 10
allowCustombooleanDefault true
limitsVideoModelLimitsMin, max, step, credits per second, base credits
getCost(seconds) => numberDefault from limits
balancenumberShows the balance after, or what is missing
modelNamestringNamed in the limit line
label, customLabelstringDefault Clip length, Custom
disabled, locale

Keyboard

KeyAction
← →Move between options
Space or EnterPick the focused option
← → on the custom sliderChange the length by one step

Accessibility

  • Options are named with their length and cost in words: "10 seconds, 40 credits". An option past the limit says why it is off.
  • The custom slider is a native range input that speaks "7 seconds".
  • A short balance is said in text, not only shown in amber.

Motion

  • Nothing moves on its own. Options press to 0.97 and the slider thumb grows slightly while held.
  • The cost rolls its digits when the length changes. Reduced motion keeps the digits still.