Animated React form components

Message composer

A white rich text composer: a text style menu that pours open, formatting that lights up under the caret, @ mentions, emoji, uploading thumbnails, a voice note timer, an AI polish, scheduled sending with a calendar, and a split send button whose plane flies off. The writing area grows with a spring as you write.

Forms, type, Motion

Install

npm i clsx lucide-react motion tailwind-merge && curl -o components/message-composer.tsx https://motion-brew.com/r/message-composer.tsx

One self contained file for React and Tailwind CSS: message-composer.tsx. Or ask your AI agent to add it through the MCP server.

Usage

import { MessageComposer } from "@/components/message-composer";

export default function Thread() {
  return (
    <MessageComposer
      people={team}
      onSend={(message) => api.post(channelId, message)}
      onUpload={(file, progress) => uploadFile(file, progress)}
      onEnhance={(text) => ai.rewrite(text)}
    />
  );
}

Props

PropTypeDefaultDescription
defaultValuestring""Starting text; lines become paragraphs, @id a chip
placeholderstringa short hintShown while the message is empty
peopleComposerPerson[]five sample peopleOffered after typing @ (id, name, title, avatar)
defaultAttachmentsComposerAttachment[][]Upload when the composer comes into view
toolbarbooleantrueShow the formatting toolbar at first
maxHeightnumber240The writing area grows up to this, then scrolls
onSend(message) => void \PromiseGets html, text, mentions, attachments, mode, and sendAt when scheduled
onUpload(file, progress) => Promise<void>pretends to uploadReport progress from 0 to 1
onEnhance(text) => string \Promise<string>tidies the textThe AI button; mentions come and go as @id
onVideo() => voidadds a sample clipThe video button
onChange(text) => voidThe message as plain text
classNamestringPlacement and width

More forms

  • OTP code: A one time code card with split boxes and no confirm button.
  • Auth card: Sign in and sign up in one card.
  • File drop: A drag and drop uploader.
  • Voice prompt: An AI composer you can talk to.

All animated react form components