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.
Components / AI Chat Interfaces
A grid of suggested prompt cards that users can click to quickly start an AI conversation with pre-written queries.
Add the necessary Shadcn UI primitives.
npx shadcn-ui@latest add card badge buttonimport { 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>
);
} 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>
);
}
Primitives required in your
@/components/ui
directory.
| Component | Path |
|---|---|
| card | @/components/ui/card |
| badge | @/components/ui/badge |
| button | @/components/ui/button |
Types and interfaces defined in this component.
interface SuggestedPrompt {
id: number;
text: string;
tags?: string[];
} interface SuggestedPrompt {
id: number;
text: string;
tags?: string[];
} interface AISuggestedPrompts01Props {
onPromptSelect?: (prompt: SuggestedPrompt) => void;
} interface AISuggestedPrompts01Props {
onPromptSelect?: (prompt: SuggestedPrompt) => void;
} Internal functions used to handle component logic.
| Function | Parameters |
|---|---|
| AISuggestedPrompts01() | { onPromptSelect, }: AISuggestedPrompts01Props |
Every JSX/HTML tag used in this component, with usage count and source.
| Tag | Count | Type | Source |
|---|---|---|---|
| <Badge> | 1× | | @/components/ui/badge |
| <Card> | 1× | | @/components/ui/card |
| <CardContent> | 1× | | @/components/ui/card |
| <div> | 2× | | Native HTML |
| <span> | 1× | | Native HTML |