Cameron Kelliher

AI Suggested Actions

AI chats 15

About

Responsive grid of suggestion buttons that display quick chat prompts users can click to start or steer a conversation.

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

Code

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

Usage.tsx

"use client";

import * as React from "react";

import { AiSuggestedActions } from "@/components/ui/suggested-actions";

const suggestions = [
  {
    label: "Explain this code",
    prompt: "Can you explain how this code works?",
  },
  { label: "Fix the bug", prompt: "There's a bug in my code. Can you help?" },
  { label: "Write tests", prompt: "Can you write unit tests for this?" },
  { label: "Optimize performance", prompt: "How can I optimize this code?" },
];

export default function Demo() {
  const [selected, setSelected] = React.useState<string | null>(null);

  return (
    <div className="mx-auto w-full max-w-md rounded-xl border bg-card p-5 text-card-foreground shadow-sm">
      <div className="mb-4 space-y-1">
        <h3 className="text-sm font-medium">How can I help you today?</h3>
        <p className="text-xs text-muted-foreground">
          Pick a suggestion to get started.
        </p>
      </div>

      <AiSuggestedActions suggestions={suggestions} onSelect={setSelected} />

      <p className="mt-4 min-h-5 text-xs text-muted-foreground">
        {selected ? (
          <>
            Sending: <span className="text-foreground">{selected}</span>
          </>
        ) : (
          "No prompt selected yet."
        )}
      </p>
    </div>
  );
}

More by Cameron Kelliher

View all
  • AI Chain of Thought

    AI Chain of Thought

    111
  • Helix Loader

    Helix Loader

    94
  • AI Streaming Text

    AI Streaming Text

    50
  • AI Tool Call

    AI Tool Call

    45
  • Signal Bars Loader

    Signal Bars Loader

    41
  • Glitch Text Loader

    Glitch Text Loader

    41
  • AI Prompt Diff

    AI Prompt Diff

    39
  • AI Routing Indicator

    AI Routing Indicator

    34

More in AI chats

View all
  • AI Actions

    AI Actions

    319
  • Color Picker

    Color Picker

    82
  • Agent Chat

    Agent Chat

    17
  • Prompt with Model Picker

    Prompt with Model Picker

    2
  • Message Thread

    Message Thread

    36
  • System Message

    System Message

    54
  • Suggestions

    Suggestions

    28
  • Modal Card

    Modal Card

    101