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.jsonWrites 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.
| Prop | Type | Default |
|---|---|---|
className | string | — |
defaultValue | string | "" |
disabled | boolean | — |
onSend | (value: string) => void | — |
onValueChange | (value: string) => void | — |
placeholder | string | "Type a message" |
valueControlled value. Omit to let the component hold its own. | string | — |
voiceShows the mic button while the field is empty, as WhatsApp does. | boolean | true |
Files
- registry/whatsapp/chat-input.tsx
- registry/whatsapp/cn.ts
- registry/whatsapp/whatsapp.css
- LICENSE