File: suggestion.md | Updated: 11/15/2025
Slash Forward
Docs Cookbook Providers Playground AI ElementsAI ElementsLeft sparkleRight sparkle AI GatewayGateway
Search...⌘KFeedback GitHub Vercel LogoSign in with Vercel
Chatbot
A suggestion component that displays a horizontal row of clickable suggestions for user interaction.
The Suggestion component displays a horizontal row of clickable suggestions for user interaction.
Preview
Code
What are the latest trends in AI?How does machine learning work?Explain quantum computingBest practices for React developmentTell me about TypeScript benefitsHow to optimize database queries?What is the difference between SQL and NoSQL?Explain cloud computing basics
AI Elements
shadcn CLI
Manual
npx ai-elements@latest add suggestion
Build a simple input with suggestions users can click to send a message to the LLM.
Add the following component to your frontend:
app/page.tsx
'use client';
import {
Input,
PromptInputTextarea,
PromptInputSubmit,
} from '@/components/ai-elements/prompt-input';
import { Suggestion, Suggestions } from '@/components/ai-elements/suggestion';
import { useState } from 'react';
import { useChat } from '@ai-sdk/react';
const suggestions = [\
'Can you explain how to play tennis?',\
'What is the weather in Tokyo?',\
'How do I make a really good fish taco?',\
];
const SuggestionDemo = () => {
const [input, setInput] = useState('');
const { sendMessage, status } = useChat();
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (input.trim()) {
sendMessage({ text: input });
setInput('');
}
};
const handleSuggestionClick = (suggestion: string) => {
sendMessage({ text: suggestion });
};
return (
<div className="max-w-4xl mx-auto p-6 relative size-full rounded-lg border h-[600px]">
<div className="flex flex-col h-full">
<div className="flex flex-col gap-4">
<Suggestions>
{suggestions.map((suggestion) => (
<Suggestion
key={suggestion}
onClick={handleSuggestionClick}
suggestion={suggestion}
/>
))}
</Suggestions>
<Input
onSubmit={handleSubmit}
className="mt-4 w-full max-w-2xl mx-auto relative"
>
<PromptInputTextarea
value={input}
placeholder="Say something..."
onChange={(e) => setInput(e.currentTarget.value)}
className="pr-12"
/>
<PromptInputSubmit
status={status === 'streaming' ? 'streaming' : 'ready'}
disabled={!input.trim()}
className="absolute bottom-1 right-1"
/>
</Input>
</div>
</div>
</div>
);
};
export default SuggestionDemo;
Preview
Code
What are the latest trends in AI?How does machine learning work?Explain quantum computingBest practices for React developmentTell me about TypeScript benefitsHow to optimize database queries?What is the difference between SQL and NoSQL?Explain cloud computing basics
Search
<Suggestions />Prop
Type
...props?React.ComponentProps<typeof ScrollArea>
<Suggestion />Prop
Type
suggestion?string
onClick?(suggestion: string) => void
...props?Omit<React.ComponentProps<typeof Button>, "onClick">
Sources
A component that allows a user to view the sources or citations used to generate a response.
Task
A collapsible task list component for displaying AI workflow progress, with status indicators and optional descriptions.
On this page
Installation
Usage with AI SDK
Features
Examples
Usage with AI Input
Props
<Suggestions />
<Suggestion />
GitHubEdit this page on GitHub Scroll to topCopy pageOpen in chat