Skip to documentation content

Prompt Suggestions

Offer prompt starters a person can send with one click, as chips, a scrolling row, or a list.

prompt-suggestions-demo

Overview

Prompt Suggestions shows a few things a person could ask next. Choosing one calls onSelect with its prompt. Sending it, or putting it in the composer first, is your application's work.

It renders the suggestions you pass. Use it under a reply, above a composer, or inside Chat Welcome on a new conversation.

Use Streaming Text's follow-ups for prompts that continue one reply, and Prompt Suggestions for starters that stand on their own.

Anatomy

PromptSuggestions
  • SuggestionA button with an optional icon and a short label

Behavior

Prompt and label

The chip shows label. When the prompt to send is longer, pass it as prompt; onSelect receives the suggestion with prompt filled in from the label when you leave it out.

Layouts

wrap flows the chips onto more lines. scroll keeps them on one line that scrolls sideways, for a narrow composer. list stacks them as full-width rows in one block, for longer prompts.

Disabled

disabled turns every suggestion off, such as while a reply is streaming.

Accessibility

The suggestions are a list of buttons named by their labels, and the list is named "Suggested prompts". They take one stop in the Tab order; the arrow keys move between them. Icons are decorative.

KeyAction
TabMove into or out of the suggestions
→ ←Move to the next or previous suggestion (↓ ↑ in the list layout)
Home EndMove to the first or last suggestion
Enter or SpaceChoose the focused suggestion

Installation

npx honestui@latest add prompt-suggestions

Usage

import { PromptSuggestions } from "@/components/ai/prompt-suggestions"

<PromptSuggestions
  suggestions={[
    { id: "late", label: "Find late invoices", prompt: "Which invoices are more than 30 days late?" },
    { id: "trend", label: "Chart this month's revenue" },
  ]}
  onSelect={(suggestion) => chat.send(suggestion.prompt)}
  disabled={chat.status === "streaming"}
/>

Examples

Scrolling row

One line that scrolls sideways.

prompt-suggestions-scroll

List

Full-width rows in one block.

prompt-suggestions-list

API reference

PromptSuggestions

Accepts native ul props beyond those listed.

PropTypeDefaultDescription
suggestionsPromptSuggestion[]RequiredThe suggestions, in order.
onSelect(suggestion: PromptSuggestion & { prompt: string }) => voidRequiredCalled with the chosen suggestion.
layout"wrap" | "scroll" | "list""wrap"Wrapping chips, one scrolling row, or stacked rows.
disabledbooleanfalseTurns every suggestion off.
labelsPartial<PromptSuggestionsLabels>EnglishThe list's accessible name.

Types

ExportShape
PromptSuggestionid, label, and optional prompt, icon