caliper uidocs

Prompt playground

Pro

Work on a prompt with real inputs: a field for every {{variable}}, model and sampling settings beside it, output with tokens and time, and saved versions you can diff against the editor, settings included.

Installs components/ui/prompt-playground.tsxDepends on @radix-ui/react-slot, lucide-reactMotion none in component source
pnpm dlx shadcn@latest add @caliper/prompt-playground

Promptv3

Saved by Maya Chen, 9 Oct

30 words · 3 variables

Write {{name}} for a variable. ⌘ Enter runs.

Variables
Settings
0.3

Run the prompt to see what the model writes.

When to use #

Use it for

  • Prompt management and LLM developer tools.
  • Internal tools where teams tune prompts together.

Skip it when

  • End users chatting with an assistant; use the chat shell.

Installation #

terminal
pnpm dlx shadcn@latest add @caliper/prompt-playground

Adds its 16 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage #

Import it from your copy of the source. The example behind the preview comes with the source. It is built from templateVariables, fillTemplate and PromptPlayground.

example.tsx
import { templateVariables, fillTemplate, PromptPlayground } from "@/components/ui/prompt-playground"

The worked example comes with Pro

The 41-line example behind the preview opens here with a Pro or Team licence.

Checking your licence…

API reference #

templateVariables

component

No props of its own; it accepts the native props of its root element.

fillTemplate

component

No props of its own; it accepts the native props of its root element.

PromptPlayground

component
PropTypeDefaultDescription
versions *readonly PromptVersion[]—Newest first. The first one opens in the editor.
models *readonly { value: string; label: string; contextWindow?: number | undefined; }[]—
valuesRecord<string, string>{}Sample values for the template’s variables.
onRun *(request: PromptParams & { prompt: string; template: string; }) => Promise<PromptRun>—A thrown error is shown in the output pane.
onSave((draft: PromptParams & { template: string; note: string; }) => void | Promise<void>)—
classNamestring—

Accessibility #

It exposes status and alert semantics, with aria-labelledby, aria-label, aria-hidden, aria-keyshortcuts, aria-describedby and aria-invalid kept in step with state. Changes that matter are announced through a live region.

KeyBehaviour
EnterActivates the focused control.

Motion #

It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.