pacekit

AI Suggestions

AI chats 9

About

A horizontally scrollable row of AI prompt suggestion chips that animate in and out, for chat and prompt input interfaces.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds AI Suggestions to your project and fits it to your theme.

Code

How AI Suggestions is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { AISuggestion, AISuggestions } from "@/components/ui/ai-suggestions";
import * as React from "react";
import { ArrowUpIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
import { Textarea } from "@/components/ui/textarea";

const suggestions = [
  "Why does shadcn win every time? 🤔",
  "Which shadcn CLI command starts a project?",
  "What is PaceKit used for exactly?",
  "How to add PaceKit components in React?",
  "Top AI trends shaping the future",
  "Why TypeScript powers scalable applications",
  "How self-learning systems actually work",
];

export default function Demo() {
  const [showSuggestions, setShowSuggestions] = React.useState(true);
  const [input, setInput] = React.useState("");
  const textAreaRef = React.useRef<HTMLTextAreaElement>(null);

  const onSuggestion = (suggestion: string) => {
    textAreaRef.current?.focus();
    setInput(suggestion);
    setShowSuggestions(false);
  };

  const onChangeInput = (value: string) => {
    setInput(value);

    if (value.trim().length == 0) {
      setShowSuggestions(true);
    }
  };

  return (
    <Card className="max-w-2xl grow" size="sm">
      <CardContent>
        <div className="text-muted-foreground flex grow justify-center py-20 font-medium">
          Chat Area
        </div>
        <AISuggestions className="me-3 mt-auto pb-1" show={showSuggestions}>
          {suggestions.map((suggestion) => (
            <AISuggestion
              className="cursor-pointer shadow-none"
              key={suggestion}
              onClick={() => onSuggestion(suggestion)}
              suggestion={suggestion}
            />
          ))}
        </AISuggestions>
        <div className="bg-card mt-2 rounded-md border">
          <Textarea
            ref={textAreaRef}
            value={input}
            onChange={(e) => onChangeInput(e.target.value)}
            className="bg-card! h-36 resize-none appearance-none border-none shadow-none ring-0!"
            placeholder="Ask me anything... It will consumed a token 😉"
          />
          <div className="flex items-end justify-between px-4 py-3">
            <p className="text-muted-foreground text-sm">Vercel / AI</p>
            <div className="flex items-end gap-3">
              <div className="flex items-center gap-1">
                55
                <p className="text-muted-foreground text-sm">/1000</p>
              </div>
              <Button className="text-primary-foreground size-8 cursor-pointer">
                <ArrowUpIcon />
              </Button>
            </div>
          </div>
        </div>
      </CardContent>
    </Card>
  );
}

Dependencies

More by pacekit

View all
  • AI Response Writer

    AI Response Writer

    364
  • Bouncing Text

    Bouncing Text

    23
  • Mouse Wave Text

    Mouse Wave Text

    21
  • Gradient Shadow

    Gradient Shadow

    16
  • Scramble Text

    Scramble Text

    14
  • Squash Text

    Squash Text

    8
  • Motion Scroll Area

    Motion Scroll Area

  • GitHub Star Counter

    GitHub Star Counter

More in AI chats

View all
  • AI Actions

    AI Actions

    361
  • Aquarium Prompt

    Aquarium Prompt

    168
  • AI Artifact

    AI Artifact

    17
  • AI Suggestions

    AI Suggestions

    22
  • AI Orb

    AI Orb

    216
  • Agent Chat

    Agent Chat

    21
  • Color Picker

    Color Picker

    229
  • AI Task List

    AI Task List

    198