Browse components

component

Chat Input

The composer. Controlled or uncontrolled, Enter to send, mic while empty.

Install

npx shadcn@latest add https://whatsapp-components.crafter.run/r/chat-input.json

Writes 4 files into your project, and installs clsx and tailwind-merge.

Preview

demos/chat-input.tsx
import { ChatInput } from "@/registry/whatsapp/chat-input";

export default function Demo() {
  return (
    <div className="flex flex-col gap-4">
      <ChatInput placeholder="Escribe un mensaje" />
      <ChatInput defaultValue="Ya con texto: el micrófono pasa a ser enviar." />
      <ChatInput placeholder="Deshabilitado" disabled />
    </div>
  );
}

Props

Read from ChatInputProps in the component source at build time.

ChatInputProps
PropTypeDefault
classNamestring—
defaultValuestring""
disabledboolean—
onSend(value: string) => void—
onValueChange(value: string) => void—
placeholderstring"Type a message"
value

Controlled value. Omit to let the component hold its own.

string—
voice

Shows the mic button while the field is empty, as WhatsApp does.

booleantrue

Files

  • registry/whatsapp/chat-input.tsx
  • registry/whatsapp/cn.ts
  • registry/whatsapp/whatsapp.css
  • LICENSE