Vesture

AI

AIPrompt

A lighter, standalone prompt launcher — a single input plus a grid of suggested-prompt cards and an optional inline slash-command menu. For a full back-and-forth conversation, use Chat instead.

AIPrompt

Preview

Usage

tsx
import { AIPrompt } from "@vesture/react";

function Example() {
  return (
    <AIPrompt
      placeholder='Ask anything, or type "/" for commands…'
      onSubmit={(prompt) => sendToMyBackend(prompt)}
      suggestions={[
        { id: "1", title: "Summarize", description: "Summarize the current page", prompt: "Summarize this page for me." },
        { id: "2", title: "Explain code", description: "Explain a selected snippet", prompt: "Explain this code snippet." },
      ]}
      commands={[
        { id: "1", label: "/summarize", template: "Summarize the following: " },
      ]}
    />
  );
}

Behavior

  • suggestions renders as a grid of cards (title + description), not just chips — clicking one fills the input with its prompt and, by default, submits immediately. Set autoSubmitOnSuggestionClick={false} to only fill the input and let the visitor review/edit before sending.
  • commands opens an inline menu when "/" is typed as the very first character of the input — not anywhere else in the text. Arrow keys move the highlight, Enter selects, and the input is replaced with the selected command's template.
  • Omit commands entirely to skip the feature — "/" then behaves as an ordinary typed character.

Props

PromptSuggestion

PropTypeDefaultDescription
id / titlestringRequired.
descriptionstringShown under the title on the card.
promptstringRequired. Text used to fill (and, by default, submit) the input.

PromptCommand

PropTypeDefaultDescription
id / labelstringRequired. label is what's shown and matched while filtering.
templatestringRequired. Replaces the input's content when this command is selected.

AIPromptProps

PropTypeDefaultDescription
onSubmit(prompt: string) => voidRequired.
suggestionsPromptSuggestion[]Rendered as a card grid above the input.
commandsPromptCommand[]Enables the slash-command menu (see behavior above).
autoSubmitOnSuggestionClickbooleantrueSet false to only fill the input on a suggestion click, not submit it.
placeholder / disabledstring / booleanPassed to the input.