Skip to content

Prompt Input

A composer with attachments, tools and a submit button.

Installation

pnpm dlx shadcn@latest add @frontal-labs/prompt-input

Usage

import { PromptInput, PromptInputAction, PromptInputTextarea } from "@/components/prompt-input";
<PromptInput isLoading={isLoading} onSubmit={send} onValueChange={setValue} value={value}>
  <PromptInputTextarea placeholder="Ask anything…" />
  <div className="flex items-center justify-end gap-1 pt-2">
    <PromptInputAction tooltip="Send">
      <Button aria-label="Send" size="icon-sm">
        <ArrowUpIcon aria-hidden="true" />
      </Button>
    </PromptInputAction>
  </div>
</PromptInput>

API Reference

PromptInput is a controlled container: it owns the value, the textarea ref and the submit handler, and shares them with its children through context.

PromptInput

Also accepts <div> attributes.

PromptInputTextarea

Also accepts Textarea props. Enter submits, Shift+Enter inserts a newline.

PromptInputAction

Wraps a single control in a tooltip, so the toolbar reads consistently.

Also accepts Tooltip props.

Open the source under Manual above for the exact prop types.

Examples