AI Prompt Playground Hero
A two-column hero: marketing copy, a heading, description, and benefit checklist on the left, and an interactive mini prompt playground on the right. Clicking an example chip shows its matching canned response, and typing a custom prompt and submitting shows a generic fallback response, giving visitors a hands-on preview before signing up.
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/ai-prompt-playground-hero.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/chat/chat20.tsx instead.
Usage
The file also exports chat20Demo, 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 { Chat20, chat20Demo } from "@/components/blocks/chat/chat20"; export default function Page() { return <Chat20 {...chat20Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Try the playground before you sign up" | Left-column heading. |
| description | string | "See how our AI responds to real prompts..." | Left-column subheading. |
| benefits | string[] | none | Benefit bullets rendered with check icons on the left. |
| examples | PlaygroundExample[] | none | Example prompt chips paired with their canned response text. |
| fallbackResponse | string | "Here's a thoughtful, well-structured response..." | Generic response shown when the visitor types and submits their own prompt. |
| className | string | none | Extra classes for the outer section element. |
Types
export interface PlaygroundExample { id: string; prompt: string; response: string; }
Behavior notes
- Real client state: clicking an example chip sets the active response from a fixed prompt/response lookup array via useState.
- Typing a custom prompt and submitting the form shows the generic fallbackResponse (also real useState), it does not call any actual AI model.
- The response panel only renders once a response has been set (defaults to the first example's response on load), matching a realistic playground first-impression.
- Full split-screen framing (grid lg:grid-cols-2 min-h-[700px]), same pattern as the Auth split-screen blocks.
More Chat Blocks
View all →rich-prompt-input-with-suggestions
Rich Prompt Input with Smart Suggestions
An AI prompt composer with attachment icons, a model selector, and a grid of clickable prompt suggestion cards.
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.