Skip to content

Message field

Pro

A rounded field for writing something to send (a comment, a reply, a chat message) that grows from a pill into a box, with a send button, tools that open into their own row on focus, a reply banner, attachments and suggestions while typing (people after @, tags after #, emoji after :); plus its trigger. Not an M3 component (@windmorph/react-pro).

import { MessageField, MessageFieldFrame, MessageFieldTrigger, MessageFieldSend, useMessageField, useMessageFieldInput, useCoarsePointer } from '@windmorph/react-pro';

Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.

Playground

Code

import { MessageField } from '@windmorph/react-pro'; <MessageField  placeholder="Write a comment… (try @ or #)"  mentions={{    search: (query) =>      [        { id: 'sam', label: 'Sam Lee' },        { id: 'priya', label: 'Priya Shah' },      ].filter((person) => person.label.toLowerCase().includes(query.toLowerCase())),  }}  tags={{    search: (query) =>      [        { id: 'design', label: 'design' },        { id: 'desserts', label: 'desserts' },      ].filter((tag) => tag.label.startsWith(query.toLowerCase())),  }}  maxLength={200}  errorMessage="Couldn't send. Try again."  clearOnSubmit  aria-label="Write a comment"/>

Examples

A comment field

A chat composer: a reply banner, attachments and a microphone

Suggestions while typing: @ for people, # for tags, : for emoji

The trigger, opening the post composer

Variants and sizes

Docked as a card's footer once it opens

A limit, a label and an error; Ctrl or ⌘ + Enter sends