AI Suggested Prompts
hextaui/ai-suggested-promptsFreeComponent
Display suggested prompts with categories and search.
Live preview
live · rendered by the registry
Rendered by HextaUI on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://hextaui.com/r/ai-suggested-prompts.jsonSource
1"use client";23import {4 Code,5 FileText,6 Lightbulb,7 Search,8 Sparkles,9 TrendingUp,10} from "lucide-react";11import { useCallback, useEffect, useMemo, useRef, useState } from "react";12import { cn } from "@/lib/utils";13import { Badge } from "@/registry/new-york/ui/badge";14import { Button } from "@/registry/new-york/ui/button";15import {16 Card,17 CardContent,18 CardDescription,19 CardHeader,20 CardTitle,21} from "@/registry/new-york/ui/card";22import {23 InputGroup,24 InputGroupAddon,25 InputGroupInput,26} from "@/registry/new-york/ui/input-group";27import { Separator } from "@/registry/new-york/ui/separator";2829export interface SuggestedPrompt {30 id: string;31 title: string;32 prompt: string;33 category: string;34 icon?: React.ComponentType<{ className?: string }>;35 description?: string;36 isRecent?: boolean;37 isPopular?: boolean;38 usageCount?: number;39}4041export interface AISuggestedPromptsProps {42 prompts?: SuggestedPrompt[];43 categories?: string[];44 onSelect?: (prompt: SuggestedPrompt) => void;45 onSearch?: (query: string) => void;46 className?: string;47 showSearch?: boolean;48 showCategories?: boolean;49 maxDisplay?: number;50 isLoading?: boolean;51}5253const defaultCategories = [54 "All",55 "Writing",56 "Code",57 "Analysis",58 "Creative",59 "Research",60];6162const categoryIcons: Record<63 string,64 React.ComponentType<{ className?: string }>65> = {66 Writing: FileText,67 Code,68 Analysis: TrendingUp,69 Creative: Sparkles,70 Research: Lightbulb,71};7273interface ComponentHeaderProps {74 title: string;75 description: string;76}7778function ComponentHeader({ title, description }: ComponentHeaderProps) {79 return (80 <div className="flex flex-col gap-1">81 <CardTitle>{title}</CardTitle>82 <CardDescription>{description}</CardDescription>83 </div>84 );85}8687interface PromptSearchProps {88 value: string;89 onChange: (value: string) => void;90 placeholder?: string;91 resultCount?: number;92}9394function PromptSearch({95 value,96 onChange,97 placeholder = "Search prompts…",98 resultCount,99}: PromptSearchProps) {100 const inputRef = useRef<HTMLInputElement>(null);101102 useEffect(() => {103 const handleKeyDown = (e: KeyboardEvent) => {104 if (105 (e.metaKey || e.ctrlKey) &&106 e.key === "k" &&107 !e.shiftKey &&108 document.activeElement !== inputRef.current109 ) {110 e.preventDefault();111 inputRef.current?.focus();112 }113 };114115 window.addEventListener("keydown", handleKeyDown);116// … truncated
What it pulls in
Other registry items
Files it writes
More from HextaUI
All 139 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | HextaUI | Components | Free | 1 dep | |
| AI Chat Historyai-chat-history | HextaUI | Components | Free | no deps | |
| AI Citationsai-citations | HextaUI | Components | Free | no deps | |
| AI Conversationai-conversation | HextaUI | Components | Free | no deps | |
| AI Error Handlerai-error-handler | HextaUI | Components | Free | no deps | |
| AI File Uploadai-file-upload | HextaUI | Components | Free | no deps | |
| AI Messageai-message | HextaUI | Components | Free | 4 deps | |
| AI Model Selectorai-model-selector | HextaUI | Components | Free | no deps |
