Primitives

Prompt

The textarea every AI builder ships instead of explaining what their product does.

The multi-line prompt box used by every AI builder. Multi-line textarea on top, toolbar on the bottom: a `+` for adding context, a model dropdown, a microphone for voice mode, and a gradient send button. Cmd/Ctrl+Enter submits.

Install

Copy this owned-code component into your app from the registry.

pnpm dlx shadcn-svelte@latest add https://benjamin-brady.github.io/performative-ui-svelte/registry/prompt.json

Examples

Default
<Prompt
  onSubmit={(text, { model }) => generate(text, model)}
/>
Custom models + voice/context wired up
<Prompt
  placeholder="Paste a tweet, get a landing page…"
  models={["o4-mini", "Claude Sonnet 4.6", "Llama 4 70B"]}
  defaultModel="Claude Sonnet 4.6"
  onAddContext={openFilePicker}
  onVoice={startVoiceMode}
  onSubmit={(text) => generate(text)}
/>

Props

PropTypeDefaultDescription
valuestring-Controlled text value.
defaultValuestring-Uncontrolled initial text.
onChange(value: string) => void-Fires on every keystroke.
onSubmit(value, ctx: {model}) => void-Fires on submit (button or Cmd/Ctrl+Enter).
placeholderstring"Build me a…"Textarea placeholder.
rowsnumber3Initial textarea height in rows.
modelsstring[]-Model options for the dropdown.
modelstring-Controlled selected model.
defaultModelstring-Uncontrolled initial model.
onModelChange(model: string) => void-Fires when the user picks a model.
onAddContext() => void-Fires when the + button is clicked.
onVoice() => void-Fires when the mic button is clicked.
hideAddContextboolean-Hide the + button.
hideModelboolean-Hide the model dropdown.
hideVoiceboolean-Hide the mic button.
hideSendboolean-Hide the send button.
submitOnCmdEnterbooleantrueSubmit when Cmd/Ctrl+Enter is pressed.
toolbarExtrasSnippet-Extra node rendered just before the mic + send buttons (e.g. a Cmd+↵ hint).
Next AsciiHero ]