Prompt Input

An input field that allows users to enter and submit text to an AI model.

Installation

pnpm dlx shadcn-svelte@latest add http://sveltekit-prerender/r/prompt-input.json

Examples

Demo

Props

PromptInput

PropTypeDefaultDescription
childrenSnippet-Prompt input content, including the textarea and action row.
classstring-Additional CSS classes for the wrapper.
isLoadingbooleanfalseMarks the prompt as loading and disables the input wrapper.
valuestring-Controlled textarea value.
onValueChange(value: string) => void-Called when the textarea value changes.
maxHeightnumber | string240Maximum auto-resize height for the textarea.
onSubmit() => void-Called when the textarea submits on Enter.

PromptInputActions

PropTypeDefaultDescription
childrenSnippet-Action buttons or controls rendered in the prompt row.
classstring-Additional CSS classes for the actions wrapper.

PromptInputAction

PropTypeDefaultDescription
tooltipSnippet-Tooltip content shown for the action.
childrenSnippet-Interactive trigger rendered inside the tooltip.
side"top" | "bottom" | "left" | "right""top"Tooltip placement relative to the trigger.
classstring-Additional CSS classes for the tooltip content.

PromptInputTextarea

PropTypeDefaultDescription
classstring-Additional CSS classes for the textarea.
disableAutosizebooleanfalseDisables the auto-resize behavior.