Prompt Input

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

Examples

Prompt Input basic

Prompt Input with actions

You can use PromptInputActions to add actions with tooltips to the PromptInput.

Installation

npx shadcn add "https://prompt-kit.com/c/prompt-input.json"

Component API

PromptInput

PropTypeDefaultDescription
isLoadingbooleanfalseLoading state of the input
valuestringControlled value of the input
onValueChange(value: string) => voidCallback when input value changes
maxHeightnumber | string240Maximum height of the textarea in pixels
onSubmit() => voidCallback when form is submitted (Enter pressed)
childrenReact.ReactNodeChild components to render
classNamestringAdditional CSS classes

PromptInputTextarea

PropTypeDefaultDescription
disableAutosizebooleanfalseDisable automatic height adjustment
classNamestringAdditional CSS classes
onKeyDown(e: KeyboardEvent) => voidKeyboard event handler
disabledbooleanfalseDisable the textarea input
...propsReact.ComponentProps<"textarea">All other textarea props are supported

PromptInputActions

PropTypeDefaultDescription
childrenReact.ReactNodeChild components to render
classNamestringAdditional CSS classes
...propsReact.HTMLAttributes<HTMLDivElement>All other div props are supported

PromptInputAction

PropTypeDefaultDescription
tooltipReact.ReactNodeContent to show in the tooltip
childrenReact.ReactNodeChild component to trigger the tooltip
classNamestringAdditional CSS classes for the tooltip
side"top" | "bottom" | "left" | "right""top"Position of the tooltip relative to the trigger
disabledbooleanfalseDisable the tooltip trigger
...propsReact.ComponentProps<typeof Tooltip>All other Tooltip component props are supported