Prompt Input

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

Installation

pnpm dlx shadcn-svelte@latest add https://svelte-ai-elements.vercel.app/p/prompt-input.json

Examples

With Actions

Use "PromptInputActions" to add actions with tooltips to the "PromptInput".

Props

PromptInput

NameTypeDefault
isLoading
boolean false
value
string ""
onValueChange
(value: string) => void
maxHeight
number | string 240
onSubmit
() => void
children
Snippet
class
string

PromptInputTextarea

NameTypeDefault
disableAutosize
boolean false
onkeydown
(event: KeyboardEvent) => void
class
string
disabled
boolean
...props
HTMLTextareaAttributes

PromptInputActions

NameTypeDefault
children
Snippet
class
string
...props
HTMLAttributes<HTMLDivElement>

PromptInputAction

NameTypeDefault
tooltip
Snippet
children
Snippet
class
string
side
"top" | "bottom" | "left" | "right" "top"
...props
Partial<TooltipPrimitive.RootProps>