A template exposes its variables as slots users complete before running — some editable, some locked by the system.
Loading demo: prompt-variable-real-world
npx sdaia-ui@latest add prompt-variable
import { PromptVariable } from '@/components/ui/PromptVariable';1<PromptVariable2label="Variable: Language_Target"3type="string"4helper="Used in 3 places"5defaultValue="TypeScript 5.4"6/>
A raised surface — the default style.
Loading demo: prompt-variable-brand
A subtle surface.
Loading demo: prompt-variable-neutral
A transparent surface with a default border.
Loading demo: prompt-variable-outline
The locked state disables the input and recolours the state badge + marker.
Loading demo: prompt-variable-states
Prop | Type | Default | Required |
|---|---|---|---|
variant | 'brand' | 'neutral' | 'outline' | 'brand' | optional |
locked | boolean | false | optional |
label | ReactNode | — | optional |
type | ReactNode | — | optional |
showType / showState | boolean | true | optional |
helper | ReactNode | — | optional |
value / defaultValue / onChange | input attrs | — | optional |
dir | 'ltr' | 'rtl' | — | optional |
labels | Partial<PromptVariableLabels> | — | optional |
How this component behaves at the three system breakpoints. Spacing and type tokens switch automatically at 768px and 1280px.
| Screen | Behavior |
|---|---|
| Desktop (1280px and up) | Fills the width of its container. |
| Tablet (768–1279px) | Same layout as desktop, with the tablet token values. |
| Phone (under 768px) | Same layout with the mobile token values. Long labels are truncated and the helper row wraps. |