Rich Prompt Input with Smart Suggestions
A sophisticated prompt input area for an AI product: an auto-expanding textarea, decorative attachment and image-upload icon buttons, a small model-selector dropdown, and a send button. Below it, a grid of contextual prompt suggestion cards let visitors preview the composer filling in with a real starter prompt when clicked.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its button dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/rich-prompt-input-with-suggestions.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/chat/chat4.tsx instead.
Usage
The file also exports chat4Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Chat4, chat4Demo } from "@/components/blocks/chat/chat4"; export default function Page() { return <Chat4 {...chat4Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "What can I help you build?" | Section heading. |
| description | string | "Describe what you need, or start from a suggestion below." | Section subheading. |
| suggestions | PromptSuggestion[] | none | Grid of clickable prompt suggestion cards. |
| modelOptions | string[] | ["GPT-4", "Claude", "Gemini"] | Options listed in the decorative model-selector dropdown. |
| className | string | none | Extra classes for the outer section element. |
Types
export interface PromptSuggestion { id: string; title: string; prompt: string; }
Behavior notes
- Only the suggestion-card-fills-input behavior is real: clicking a card sets the controlled Textarea's value via useState.
- The attachment and image-upload icon buttons are decorative, they have no onClick handler and don't open any file picker.
- The model-selector dropdown is an uncontrolled, decorative <select> with no real model-switching logic behind it.
- The send button is decorative and does not submit or call any API.
- The textarea auto-expands via the Textarea component's built-in field-sizing-content CSS, no JS resize logic.
More Chat Blocks
View all →ai-streaming-response-typewriter
AI Streaming Response with Live Typing
A single AI chat exchange with a skeleton loading state, a word-by-word typewriter reveal, and a stop-generating control.
ai-response-with-cited-sources
AI Response with Cited Sources
A Perplexity-style answer with inline numbered citation markers and an expandable source list below it.
code-generation-chat-with-syntax-highlighting
Code Generation Chat with Syntax Highlighting
A developer chat message with a file-name tab bar, a language badge, illustrative syntax coloring, and a real copy button.
prompt-starter-grid
AI Prompt Starter Grid
A tabbed grid of prompt template cards, filterable by category, each with an icon, title, and description.
ai-agent-profile-card
AI Agent Profile Card
A showcase card for an AI agent with avatar, capability badges, a sample chat preview, stats, and action buttons.
floating-chat-widget
Floating Chat Widget with Expandable Window
A corner chat bubble with a pulsing notification dot that expands into a mini chat window.