Command Palette

Search for a command to run...

AI Elements / Chat/AI Chat Input

AI Chat Input

Expandable chat input with send button, file attachments, and keyboard shortcuts

Open in v0Open in

Overview

An expandable chat input component with send button, keyboard shortcuts, and optional file attachment support. Auto-expands as you type and supports Cmd+Enter (or Ctrl+Enter) to submit.

Installation

bunx shadcn@latest add @elements/chat-input

Usage

import { ChatInput } from "@/components/elements/ai-elements/chat/chat-input";

export function ChatInterface() {
  const handleSubmit = (message: string) => {
    console.log("Message:", message);
  };

  return (
    <ChatInput
      onSubmit={handleSubmit}
      placeholder="Type a message..."
    />
  );
}

Props

PropTypeDefaultDescription
onSubmit(message: string) => void-Callback when message is submitted
placeholderstring"Type a message..."Placeholder text
disabledbooleanfalseDisable the input
loadingbooleanfalseShow loading state
allowAttachmentsbooleanfalseShow attachment button
classNamestring-Additional CSS classes

Features

  • Auto-expanding textarea
  • Cmd+Enter / Ctrl+Enter to submit
  • Loading state with spinner
  • Optional file attachments
  • Disabled state support