Skip to content

Rich message field

Pro

A message field that formats as you type, with markers in plain text: bold, italic, strike, code, links, lists, quotes and code blocks, with a formatting toolbar, and suggestions while typing (@mentions of people, #tags and emoji after :); plus FormattedText, which shows what it wrote. Not an M3 component (@windmorph/react-pro/rich-text, with Tiptap).

import { RichMessageField, FormattingToolbar, FormattedText, useRichMessageField } from '@windmorph/react-pro/rich-text';

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 { RichMessageField } from '@windmorph/react-pro/rich-text'; <RichMessageField  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())),  }}  errorMessage="Couldn't send. Try again."  clearOnSubmit  aria-label="Write a comment"/>

Examples

A comment field, and the comments it wrote

A post's composer: the toolbar always shows, Enter is a new line

A post’s composer in a dialog, with a smaller corner than the dialog’s

Mentions: @ suggests people, and posted mentions link to them

Tags and emoji beside mentions: # suggests tags, : suggests emoji