Skip to content
Sign in
VideoVideo prompt barMenu

Video prompt barPro

The video prompt: start and end frame slots above the text, and chips for length, aspect and camera motion in the line. The cost follows the length, a short balance blocks Generate with the reason, and Generate turns into Stop while the clip renders.

ProA start frame, length, aspect and a dolly move in the line. Generate renders and turns into Stop; the cost follows the length.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/video-prompt-bar

Usage

tsx
import { VideoPromptBar } from "@/components/ui/chatcn/pro/video-prompt-bar"

<VideoPromptBar
  limits={{ minSeconds: 2, maxSeconds: 10, creditsPerSecond: 4 }}
  balance={credits}
  status={status}
  onGenerate={({ prompt, params, cost }) => render(prompt, params)}
  onStop={cancel}
/>

It is the free prompt-input with what a video needs in the line. Each chip opens the full editor in a popover: the duration-picker for length, the free aspect-ratio-picker and the camera-motion-picker. Drop an image on either frame slot, or press it to choose a file. params holds the length, aspect, camera moves and both frames, controlled or not.

The cost is limits.creditsPerSecond times the length unless you pass getCost. When a run costs more than balance, Generate stays off, Enter says why, and a line under the bar says how many credits are missing. The text stays editable so nothing typed is lost.

Examples

States

Both frames with two moves, a balance too low for 10 s, generating, disabled and right to left.

ProStart and end frames with two moves, a balance too low for 10 s, generating and disabled.

Props

PropTypeNotes
value, defaultValue, onValueChangestringThe prompt
params, defaultParams, onParamsChangeVideoPromptParamsduration, aspect, camera, startFrame, endFrame
limitsVideoModelLimitsMin, max, step and credits per second
modelNamestringNamed in the length limit line
durationsnumber[]One tap lengths. Default 5 and 10
aspectRatiosstring[]Default 16:9, 9:16, 1:1, 4:3, 21:9
getCost(params) => numberDefault from limits and the length
balancenumberGenerate is held while a run costs more
onGenerate(request) => voidPrompt, params and cost
status, onStop"idle" | "submitting" | "generating"Generating turns Generate into Stop
endFramebooleanOffer an end frame slot. Default true
variant"default" | "floating" | "hero"The prompt-input surfaces
disabled, placeholder

Keyboard

KeyAction
EnterGenerate. Never while composing with an IME
Shift + EnterNew line
EscStop while generating; close a chip editor
Enter or Space on a frame slotChoose an image

Accessibility

  • Every chip is a button named with its parameter and value: "Length: 5 s", "Camera motion: Dolly in 40%".
  • Frame slots are buttons ("Add start frame") and say when a frame is set or removed in a polite live region.
  • The cost is focusable and its tooltip names the length and the balance left.
  • Out of credits, the reason is in text and announced when Enter is pressed, not only shown in amber.

Motion

  • Chip editors grow from their chip in 180 ms. A chip whose value changes swaps its text with a 150 ms blur crossfade.
  • A dropped frame fades into its slot in 200 ms. Reduced motion keeps only fades.