Components / AI Chat Interfaces

AI Suggested Prompts

A grid of suggested prompt cards that users can click to quickly start an AI conversation with pre-written queries.

Live Preview — ai-suggested-prompts-01
Explain ShadCN UI components with examples
UIReact
Generate a TypeScript function for sorting arrays
CodeTS
Summarize latest AI news
AISummary
Write a friendly email template
WritingEmail
Convert JSON to CSV in Python
CodePython
Create a workout plan for beginners
HealthPlan

Installation

Shadcn UI Setup

Add the necessary Shadcn UI primitives.

npm
npx shadcn-ui@latest add card badge button

Source Code

ai-suggested-prompts-01.tsx
import { Card, CardContent } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";

interface SuggestedPrompt {
    id: number;
    text: string;
    tags?: string[];
}

interface AISuggestedPrompts01Props {
    onPromptSelect?: (prompt: SuggestedPrompt) => void;
}

export default function AISuggestedPrompts01({
    onPromptSelect,
}: AISuggestedPrompts01Props) {
    // Self-contained prompt data
    const prompts: SuggestedPrompt[] = [
        { id: 1, text: "Explain ShadCN UI components with examples", tags: ["UI", "React"] },
        { id: 2, text: "Generate a TypeScript function for sorting arrays", tags: ["Code", "TS"] },
        { id: 3, text: "Summarize latest AI news", tags: ["AI", "Summary"] },
        { id: 4, text: "Write a friendly email template", tags: ["Writing", "Email"] },
        { id: 5, text: "Convert JSON to CSV in Python", tags: ["Code", "Python"] },
        { id: 6, text: "Create a workout plan for beginners", tags: ["Health", "Plan"] },
    ];

    return (
        <div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
            {prompts.map((prompt) => (
                <Card
                    key={prompt.id}
                    className="p-0 cursor-pointer hover:bg-muted"
                    onClick={() => onPromptSelect?.(prompt)}
                >
                    <CardContent className="p-4 flex flex-col gap-2">
                        <span className="text-sm font-medium">{prompt.text}</span>
                        {prompt.tags && (
                            <div className="flex flex-wrap gap-1">
                                {prompt.tags.map((tag) => (
                                    <Badge key={tag} variant="outline" className="text-xs">
                                        {tag}
                                    </Badge>
                                ))}
                            </div>
                        )}
                    </CardContent>
                </Card>
            ))}
        </div>
    );
}

Shadcn Components

Primitives required in your @/components/ui directory.

Component Path
card @/components/ui/card
badge @/components/ui/badge
button @/components/ui/button

Type Reference

Types and interfaces defined in this component.

SuggestedPrompt
interface SuggestedPrompt {
    id: number;
    text: string;
    tags?: string[];
}
AISuggestedPrompts01Props
interface AISuggestedPrompts01Props {
    onPromptSelect?: (prompt: SuggestedPrompt) => void;
}

Functional Logic

Internal functions used to handle component logic.

Function Parameters
AISuggestedPrompts01() { onPromptSelect, }: AISuggestedPrompts01Props

JSX Tags Usage

Every JSX/HTML tag used in this component, with usage count and source.

Tag Count Type Source
<Badge> Library @/components/ui/badge
<Card> Library @/components/ui/card
<CardContent> Library @/components/ui/card
<div> Native Native HTML
<span> Native Native HTML

Related Components

  • AI Chat Bubble — A conversational chat bubble component with typing indicator, avatar support, and message timestamps for AI chat interfaces.
  • AI Chat Input Bar — A modern chat input bar with send button, attachment support, and auto-resize textarea for AI conversation interfaces.
  • AI Chat Window — A full-featured AI chat window with message history, streaming response animation, and conversation management.
  • AI Streaming Text — A typewriter-style streaming text component that simulates token-by-token AI response generation with cursor animation.
  • AI Chat Sidebar — A conversation history sidebar listing previous AI chat sessions with search, date grouping, and active state indicators.
  • AI Model Selector — A dropdown model selector for choosing between AI models (GPT-4, Claude, Gemini) with model info badges and capability indicators.