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.

Props

By name or description, across the 149 props below

MessageField 70 props

  • valuetype string

    The text (controlled).

  • defaultValuetype stringdefault ""

    The text at first (uncontrolled).

  • submitOntype "enter" | "mod-enter" | "none"default "enter"

    When Enter sends: enter (Shift+Enter is a new line), mod-enter (Ctrl/⌘+Enter) or none (only the send button). On touch screens Enter is always a new line.

  • clearOnSubmittype booleandefault false

    Clear the text after onSubmit. Otherwise the app clears it once the send succeeds.

  • placeholdertype string

    Hint inside the field. Never the only name: give a label or aria-label too.

  • minRowstype numberdefault 1

    The height the field keeps when the text is shorter, in lines.

  • maxRowstype numberdefault 6

    Rows after which the text scrolls inside the field.

  • autoFocustype boolean

    Focuses the text when the field appears, starting it open with expandOnFocus.

  • nametype string

    The form field name.

  • formtype string

    The id of the <form> the field belongs to, when it isn't inside it.

  • inputReftype Ref<HTMLTextAreaElement>

    The <textarea>.

  • mentionstype MentionSuggestionsOptions

    Mentions: @ and a name suggest people from search (the app decides who and in what order), and choosing one puts @Name in the text. Without it, @ is just a character. The list's keys are the text's (Up, Down, Enter, Tab, Escape), so focus stays there.

  • tagstype TagSuggestionsOptions

    Tags: # and a word suggest tags from search, and choosing one puts #tag in the text. A tag typed that isn't suggested stays as typed. Without it, # is just a character.

  • emojiSuggestionstype EmojiSuggestionSource

    Emoji: : and two letters (:sm) suggest emoji, and choosing one puts it in place of :sm. Built by createEmojiSuggestions from @windmorph/react-pro/emoji-picker, which holds the data and the options (minChars, replaceOnColon, maxItems, emoticons), so a field without it never loads the emoji data. Off without it.

  • sendabletype boolean

    Whether there's something to send. Left out, any text is; set it when attachments count (a photo alone can be sent) or must finish first (an upload still running). Text over maxLength never sends.

  • pendingtype booleandefault false

    The send is in flight (React 19's word for an action under way): Send ignores presses, its name gains labels.sending, which is announced politely, and its loading indicator shows after 200ms.

  • sendtype booleandefault true

    Show the send button.

  • sendVarianttype "filled" | "standard"default "filled"

    filled: a filled circle, as the search bar's action. standard: the icon alone, in the send-color token (primary), a quieter Send beside icon tools.

  • sendIcontype ReactNode

    Replaces the send icon.

  • emptyActiontype ReactNode

    Shown in Send's place while there's nothing to send, e.g. a microphone button.

  • supportingTexttype ReactNode

    Helper text under the field.

  • errorMessagetype ReactNode

    Shown under the field, in the error roles, while invalid; announced when it appears.

  • invalidtype boolean

    Marks the field invalid. A send that ends while invalid shakes the field once.

  • maxLengthtype number

    The most characters, counted as people see them (grapheme clusters): an emoji sequence such as a family, a flag or a letter with a combining accent is one, whatever its UTF-16 length (the textarea's own maxlength isn't used), so a limit in UTF-16 units or bytes on the server needs its own check. The text may go over: the counter then shows in the error colour, the field is invalid and Send waits.

  • countertype booleandefault false

    Always show the counter (with maxLength), not only from counterThreshold.

  • counterThresholdtype numberdefault 0.9

    The share of maxLength (0–1) from which the counter shows and is announced.

  • sizetype "sm" | "md" | "lg"default "md"

    One-line height: sm 40px, md 48px, lg 56px.

  • varianttype "filled" | "tonal" | "outlined"default "filled"

    The container: filled (surface-container-high), tonal (secondary-container) or outlined (a transparent pill with an outline border).

  • leadingtype ReactNode

    Before the text, centred on its first line: an avatar or icon buttons.

  • trailingtype ReactNode

    Icon buttons after the text, before Send.

  • toolstype ReactNode

    Tools: icon buttons with their own actions (emoji, attach, GIF), in a toolbar (one Tab stop, arrow keys between them). They sit at the end of the text row and, with expandOnFocus, move to their own row when the field opens. They get the field's size and disabled state; useMessageField() lets them insert text.

  • expandOnFocustype booleandefault false

    Opens the field on its first focus, growing from a one-line pill into two rows: the text takes the first row, and the tools and Send move to a second one. It stays open, so the page doesn't move each time focus leaves. It also opens with anything in it.

  • defaultOpentype booleandefault false

    With expandOnFocus, starts open rather than as the pill: a field that appears focused (autoFocus, a reply under a comment) is there at full height, with no opening to run alongside whatever reveals it.

  • toolsWhenIdletype "hidden" | "inline"default "inline"

    Where the tools are while the field is closed (expandOnFocus).

  • bannertype ReactNode

    A row above the text inside the field, such as "Replying to Alex".

  • closeIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Replaces the banner's close icon.

  • toolbartype ReactNode

    A row of controls inside the open field, such as formatting buttons. It opens the field.

  • toolbarPlacementtype "auto" | "top" | "bottom"default "auto"

    Where the toolbar row sits in the open field: top, above the text; bottom, between the text and the tools (in thumb reach on phones); auto, bottom on compact windows and top from medium. Below the text, the row also follows it in the page, so Tab reaches the rows in the order they show.

  • attachmentstype ReactNode

    A row of content above the text inside the field, such as MediaUploadGrid.

  • accepttype readonly string[]

    File types onFileAccept takes: MIME types, wildcards (image/*) or extensions (.pdf). A file's type comes from the system and can differ from the one you expect (a CSV is application/vnd.ms-excel where a spreadsheet app owns the extension), so list the extensions too: ['text/csv', '.csv'].

  • dockedtype boolean | "when-open"default false

    Square corners, as a footer edge to edge with its container (a card's comment field), morphing from the pill on the field's spring. when-open docks once the field opens (expandOnFocus) and stays docked, as it stays open. Where it sits is the app's (className and classNames.field, which data-docked styles).

  • requiredtype booleandefault false

    The field must be filled in (aria-required); the label gets an asterisk.

  • disabledtype booleandefault false

    Disables the field, its slots and its tools.

  • readOnlytype booleandefault false

    The text can be read and selected but not changed; Send hides.

  • handleReftype Ref<MessageFieldTextBox>

    insertText, focus and clear, for the app.

  • reftype Ref<HTMLDivElement>

    The root element.

  • idtype stringdefault a generated id

    The <textarea>'s id.

  • enterKeyHinttype "enter" | "done" | "go" | "next" | "previous" | "search" | "send"default "send" where Enter sends, else the browser's

    The on-screen keyboard's Enter key.

  • spellChecktype booleandefault the browser's

    Whether the browser checks the spelling.

  • autoCompletetype string

    The <textarea>'s autocomplete.

  • autoCorrecttype string

    Whether the on-screen keyboard corrects words (autocorrect, Safari).

  • inputModetype "none" | "text" | "search" | "tel" | "url" | "email" | "numeric" | "decimal"default "text"

    The on-screen keyboard to show.

  • labeltype ReactNode

    The visible label above the field. Give it, aria-label or aria-labelledby: the placeholder is never the only name.

Events

  • onChangetype ((value: string) => void)

    Called with the text as it changes.

  • onSubmittype ((value: string) => void)

    Called with the trimmed text on Enter (see submitOn) or the send button, while there's something to send and the text is within maxLength.

  • onEscapetype (() => void)

    Escape in the field, e.g. to cancel a reply.

  • onBannerClosetype (() => void)

    Shows a close button on the banner, e.g. to cancel the reply.

  • onFilePicktype ((pick: FilePick) => void)

    Called once for each paste or drop onto the field that brings files, with every file it brought: the files taken and the files refused with their reasons, in the order they came (accepted is empty when every file was refused, rejected when none was). Called first, then onFileAccept and onFileReject, all in the same task, so an app can treat a paste or drop as one thing (add what fits, and say once what was left out). A paste the field leaves as text calls nothing.

  • onFileAccepttype ((files: File[]) => void)

    Called with files pasted or dropped onto the field that match accept. Without it or onFilePick, files are ignored.

  • onFileRejecttype ((rejections: FileRejection[]) => void)

    Called with the files a paste or drop brought that don't match accept (reason type), after onFileAccept; never with an empty list. Only while the field takes files (onFileAccept or onFilePick, not disabled or read-only). A paste whose HTML holds words is a text paste whatever files it carries (copied cells or a document bring a picture of themselves), neither taken nor reported; one with no file taken goes on as usual, reporting its files unless it carries plain text (a copied file's name).

  • onFocustype ((event: FocusEvent<HTMLTextAreaElement, Element>) => void)

    Called when the text gets focus.

  • onBlurtype ((event: FocusEvent<HTMLTextAreaElement, Element>) => void)

    Called when the text loses focus.

Text

  • labelstype Partial<MessageFieldLabels>

    Every word the field says, from the app's translations (each key's default is on MessageFieldLabels). A LabelsProvider sets them for the whole app.

  • aria-describedbytype string

    More ids describing the text, after the supporting text and error.

  • aria-detailstype string

    The id of an element with more details about the field.

  • aria-labeltype string

    Names the field for screen readers when there's no visible label, e.g. "Write a comment".

  • aria-labelledbytype string

    The id of a visible element that names the field, instead of label.

Also accepts the root element's HTML attributes (id, data-*, event handlers).

MessageFieldFrame 51 props

  • childrentype ReactNodeRequired

    The text box: it reads useMessageFieldInput and registers its textBoxRef.

  • lengthtype numberRequired

    Characters in the text as people see them, for the counter and the limit: count grapheme clusters (Intl.Segmenter), as MessageField and RichMessageField do, not value.length.

  • emptytype booleanRequired

    The text is blank.

  • sendabletype boolean

    Whether there's something to send. Left out, any text is; set it when attachments count (a photo alone can be sent) or must finish first (an upload still running). Text over maxLength never sends.

  • pendingtype booleandefault false

    The send is in flight (React 19's word for an action under way): Send ignores presses, its name gains labels.sending, which is announced politely, and its loading indicator shows after 200ms.

  • sendtype booleandefault true

    Show the send button.

  • sendVarianttype "filled" | "standard"default "filled"

    filled: a filled circle, as the search bar's action. standard: the icon alone, in the send-color token (primary), a quieter Send beside icon tools.

  • sendIcontype ReactNode

    Replaces the send icon.

  • emptyActiontype ReactNode

    Shown in Send's place while there's nothing to send, e.g. a microphone button.

  • supportingTexttype ReactNode

    Helper text under the field.

  • errorMessagetype ReactNode

    Shown under the field, in the error roles, while invalid; announced when it appears.

  • invalidtype boolean

    Marks the field invalid. A send that ends while invalid shakes the field once.

  • maxLengthtype number

    The most characters, counted as people see them (grapheme clusters): an emoji sequence such as a family, a flag or a letter with a combining accent is one, whatever its UTF-16 length (the textarea's own maxlength isn't used), so a limit in UTF-16 units or bytes on the server needs its own check. The text may go over: the counter then shows in the error colour, the field is invalid and Send waits.

  • countertype booleandefault false

    Always show the counter (with maxLength), not only from counterThreshold.

  • counterThresholdtype numberdefault 0.9

    The share of maxLength (0–1) from which the counter shows and is announced.

  • sizetype "sm" | "md" | "lg"default "md"

    One-line height: sm 40px, md 48px, lg 56px.

  • varianttype "filled" | "tonal" | "outlined"default "filled"

    The container: filled (surface-container-high), tonal (secondary-container) or outlined (a transparent pill with an outline border).

  • leadingtype ReactNode

    Before the text, centred on its first line: an avatar or icon buttons.

  • trailingtype ReactNode

    Icon buttons after the text, before Send.

  • toolstype ReactNode

    Tools: icon buttons with their own actions (emoji, attach, GIF), in a toolbar (one Tab stop, arrow keys between them). They sit at the end of the text row and, with expandOnFocus, move to their own row when the field opens. They get the field's size and disabled state; useMessageField() lets them insert text.

  • expandOnFocustype booleandefault false

    Opens the field on its first focus, growing from a one-line pill into two rows: the text takes the first row, and the tools and Send move to a second one. It stays open, so the page doesn't move each time focus leaves. It also opens with anything in it.

  • defaultOpentype booleandefault false

    With expandOnFocus, starts open rather than as the pill: a field that appears focused (autoFocus, a reply under a comment) is there at full height, with no opening to run alongside whatever reveals it.

  • toolsWhenIdletype "hidden" | "inline"default "inline"

    Where the tools are while the field is closed (expandOnFocus).

  • bannertype ReactNode

    A row above the text inside the field, such as "Replying to Alex".

  • closeIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Replaces the banner's close icon.

  • toolbartype ReactNode

    A row of controls inside the open field, such as formatting buttons. It opens the field.

  • toolbarPlacementtype "auto" | "top" | "bottom"default "auto"

    Where the toolbar row sits in the open field: top, above the text; bottom, between the text and the tools (in thumb reach on phones); auto, bottom on compact windows and top from medium. Below the text, the row also follows it in the page, so Tab reaches the rows in the order they show.

  • attachmentstype ReactNode

    A row of content above the text inside the field, such as MediaUploadGrid.

  • accepttype readonly string[]

    File types onFileAccept takes: MIME types, wildcards (image/*) or extensions (.pdf). A file's type comes from the system and can differ from the one you expect (a CSV is application/vnd.ms-excel where a spreadsheet app owns the extension), so list the extensions too: ['text/csv', '.csv'].

  • dockedtype boolean | "when-open"default false

    Square corners, as a footer edge to edge with its container (a card's comment field), morphing from the pill on the field's spring. when-open docks once the field opens (expandOnFocus) and stays docked, as it stays open. Where it sits is the app's (className and classNames.field, which data-docked styles).

  • requiredtype booleandefault false

    The field must be filled in (aria-required); the label gets an asterisk.

  • disabledtype booleandefault false

    Disables the field, its slots and its tools.

  • readOnlytype booleandefault false

    The text can be read and selected but not changed; Send hides.

  • handleReftype Ref<MessageFieldTextBox>

    insertText, focus and clear, for the app.

  • reftype Ref<HTMLDivElement>

    The root element.

  • labeltype ReactNode

    The visible label above the field. Give it, aria-label or aria-labelledby: the placeholder is never the only name.

  • minRowstype numberdefault 1

    The height the field keeps when the text is shorter, in lines.

  • idtype stringdefault a generated id

    The text box's id.

Events

  • onBannerClosetype (() => void)

    Shows a close button on the banner, e.g. to cancel the reply.

  • onFilePicktype ((pick: FilePick) => void)

    Called once for each paste or drop onto the field that brings files, with every file it brought: the files taken and the files refused with their reasons, in the order they came (accepted is empty when every file was refused, rejected when none was). Called first, then onFileAccept and onFileReject, all in the same task, so an app can treat a paste or drop as one thing (add what fits, and say once what was left out). A paste the field leaves as text calls nothing.

  • onFileAccepttype ((files: File[]) => void)

    Called with files pasted or dropped onto the field that match accept. Without it or onFilePick, files are ignored.

  • onFileRejecttype ((rejections: FileRejection[]) => void)

    Called with the files a paste or drop brought that don't match accept (reason type), after onFileAccept; never with an empty list. Only while the field takes files (onFileAccept or onFilePick, not disabled or read-only). A paste whose HTML holds words is a text paste whatever files it carries (copied cells or a document bring a picture of themselves), neither taken nor reported; one with no file taken goes on as usual, reporting its files unless it carries plain text (a copied file's name).

  • onSendtype () => voidRequired

    Send pressed, or Enter (requestSend), while there's something to send.

Text

  • labelstype Partial<MessageFieldLabels>

    Every word the field says, from the app's translations (each key's default is on MessageFieldLabels). A LabelsProvider sets them for the whole app.

  • aria-labeltype string

    Names the field for screen readers when there's no visible label, e.g. "Write a comment".

  • aria-labelledbytype string

    The id of a visible element that names the field, instead of label.

  • aria-describedbytype string

    More ids describing the text box, after the supporting text and error.

  • aria-detailstype string

    The id of an element with more details about the field.

Also accepts the root element's HTML attributes (id, data-*, event handlers).

MessageFieldTrigger 17 props

  • childrentype ReactNodeRequired

    The prompt, such as "What's on your mind?". It names the button.

  • leadingtype ReactNode

    Before the prompt, usually the person's avatar. Decorative: the prompt names the button.

  • trailingtype ReactNode

    An icon after the prompt, such as a photo icon. Decorative, and never a second button.

  • toolstype ReactNode

    The icons of the field's tools (emoji, attach), at the end, sized and spaced as the field's tool buttons, so the pill looks like the field it opens into. Decorative: give the icons themselves, not buttons. Hidden when the pill is too narrow to keep the prompt.

  • sizetype "sm" | "md" | "lg"default "md"

    One-line height: sm 40px, md 48px, lg 56px, as MessageField.

  • varianttype "filled" | "tonal" | "outlined"default "filled"

    The container, as the field it opens into: filled (surface-container-high), tonal (secondary-container) or outlined (a transparent pill with an outline border).

  • disabledtype booleandefault false

    Disables the button or link.

  • idtype string

    The button's or link's id.

  • hreftype string

    Renders a link to the composer's page instead of a button.

  • reftype Ref<HTMLButtonElement> | Ref<HTMLAnchorElement>

    Ref to the root element: the <button>, or the <a> with href.

Events

  • onPresstype (() => void)

    Opens the composer; with href, called besides following the link.

Text

  • aria-labeltype string

    Overrides the prompt as the accessible name.

  • aria-labelledbytype string

    The id of the element that names the trigger, instead of the prompt.

  • aria-describedbytype string

    Ids of elements that describe the trigger.

MessageFieldSend 11 props

  • varianttype "filled" | "standard"default "filled"

    filled: a filled circle, as the search bar's action. standard: the icon alone, in the send-color token (primary).

  • icontype ReactNode

    Replaces the Material Symbols send icon; mirrored in right-to-left text.

  • pendingtype booleandefault false

    The send is in flight: presses are ignored, the button's name gains labels.sending, and the core IconButton's loading indicator takes the icon's place after 200ms, so a quick send doesn't flash.

  • disabledtype booleandefault false

    Disables the button (nothing to send).

  • idtype string

    The button's id.

  • reftype Ref<HTMLButtonElement>

    The <button>.

Events

  • onPresstype () => voidRequired

    Called on a press, unless pending.

Text

  • labelstype Partial<MessageFieldSendLabels>

    Its words: the button's name, and what it adds while pending. A LabelsProvider sets them for the whole app.

Types

MentionSuggestionsOptions 3 fields

How a field suggests people after @.

  • maxItemstype numberdefault 8

    How many people the list shows at most.

  • classNamestype SuggestionListClassNames

    Classes for the list's parts (and its tokens, as the list renders outside the field).

TagSuggestionsOptions 3 fields

How a field suggests tags after #.

  • maxItemstype numberdefault 8

    How many tags the list shows at most.

  • classNamestype SuggestionListClassNames

    Classes for the list's parts (and its tokens, as the list renders outside the field).

MentionSuggestion 4 fields

Someone the field suggests after @.

  • idtype stringRequired

    Stored in the rich field's text: <@id|label>.

  • labeltype stringRequired

    The name the mention shows, as written.

  • descriptiontype string

    A second line, e.g. @username or "Friend".

  • avatartype string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<AwaitedReactNode>

    Shown before the name, usually an Avatar.

TagSuggestion 4 fields

A tag the field suggests after #.

  • idtype stringRequired

    Stored in the rich field's text: <#id|label>.

  • labeltype stringRequired

    The tag as written, without # ("design").

  • descriptiontype string

    A second line, e.g. how many posts use it.

  • icontype string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<AwaitedReactNode>

    Shown before the tag.

Hooks

useMessageField

useMessageField signature
useMessageField(): MessageFieldContextValue

For a tool in the field's tools: insert text at the caret, or focus the text.

Returns MessageFieldContextValue

  • isOpentype booleanRequired

    The field is open (expandOnFocus): the tools are on their own row.

  • focustype () => voidRequired

    Puts the caret in the text (at its end, unless it's already inside), without scrolling the page (preventScroll): the frame reveals the field itself when it's off screen.

  • insertTexttype (text: string, options?: InsertTextOptions | undefined) => voidRequired

    Puts text at the caret, replacing the selection, and leaves the caret after it. With { focus: false } the text box isn't focused first, for a tool whose pick leaves focus in its own panel (the emoji picker after a keyboard or touch pick, docked in the keyboard's place, or in its bottom sheet): the text goes in at the kept selection. The text is always plain text (the rich field never reads it as HTML).

  • cleartype () => voidRequired

    Empties the text.

useMessageFieldInput

useMessageFieldInput signature
useMessageFieldInput(): MessageFieldInputContextValue

For a text box inside MessageFieldFrame: its attributes, classes and the frame's send.

Returns MessageFieldInputContextValue

  • fieldPropstype React.DOMAttributes<HTMLElement> & React.AriaAttributes & { id?: string | undefined; }Required

    Spread on the text box: its id, name and description (aria-labelledby, …), its state (aria-invalid, aria-required) and the app's other widget attributes (aria-controls, aria-expanded …).

  • classNametype stringRequired

    The input slot's classes, for the text box element.

  • textBoxReftype React.RefObject<MessageFieldTextBox | null>Required

    The text box registers itself here (useImperativeHandle).

  • requestSendtype () => voidRequired

    Enter's send: sends when the frame would (there's something, not over the limit).

  • isOpentype booleanRequired

    The field is open (expandOnFocus).

  • sizetype "sm" | "md" | "lg"Required

    The field's size.

  • isInvalidtype booleanRequired

    The field is invalid (invalid, or over maxLength).

  • isDisabledtype booleanRequired

    The field is disabled.

  • isReadOnlytype booleanRequired

    The field is read-only.

  • isRequiredtype booleanRequired

    The field is required.

useCoarsePointer

useCoarsePointer signature
useCoarsePointer(): boolean

Whether the main pointer is a finger (a phone or tablet). The server and the first render say no, so they agree; the browser's answer follows at once.

Returns boolean

Spec status

Not part of Material Design 3: a Windmorph Pro component, built on M3's colour roles, type scale, shapes and motion. Its variants and configurations each link to a live example.

  • Variants: filled, tonal and outlined

    Built

    Variant · Variants

  • Sizes: sm, md and lg

    Built

    Configuration · Variants

  • Opens on focus, with tools and a standard Send

    Built

    Configuration · Comment

  • Reply banner, attachments and an empty action

    Built

    Configuration · Chat

  • Docked as a footer

    Built

    Configuration · Docked

  • Character limit, label, supporting text and error

    Built

    Configuration · Limit

  • Send on Ctrl or ⌘ + Enter

    Built

    Configuration · Limit

  • Suggestions while typing: people, tags and emoji (mentions, tags, emojiSuggestions)

    Built

    Configuration · Suggestions

  • Comments and chat

    Built

    Use case · Comment, Chat

  • A trigger that opens a composer (MessageFieldTrigger)

    Built

    Use case · Trigger

  • Built on the M3 search bar and text field

    Extension

    A pill like the search bar that grows into a rounded box over several lines, with the text field’s colour roles, a counter and error text; M3 has no message composer of its own.

M3 Expressive specs

Sizes
sm, md, lg
Shape
rounded-corner-full
Variants
filled, tonal, outlined

Theming & tokens

  • variant: filled (surface-container-high, as the search bar), tonal (secondary-container) or outlined (an outline border, primary while focused). The tonal placeholder is on-surface-variant, quieter than the text, and switches to on-secondary-container at medium and high contrast so it keeps 4.5:1 (an app's --wm-message-field-placeholder still wins). Disabled colours use the system disabled opacities. size: sm 40px (body-medium), md 48px and lg 56px (body-large).
  • A grown field's corner is extra-large (28px), close to the pill's own radius, so the corners barely change as it grows. Inside a container with corners of its own (a dialog, a card, a sheet), set a smaller one than the container's, for example --wm-message-field-grown-corner: var(--md-sys-shape-corner-large), so the field reads as a rounded rectangle in it and not a second bubble. The post composer of the trigger example does.
  • Every value the field paints is a token: set the variables below on the field (className) or on any ancestor, globally or per theme. Sizes and variants only change their defaults. The send button, the banner's close button and the tools are ordinary IconButtons, so a theme reaches them as it does any button, and classNames reaches each one.
  • classNames styles the root, label, field, banner, bannerClose, toolbar, attachments, leading, input, tools, trailing, the send button's parts (send.root, send.icon, send.glyph, send.loading), emptyAction, supportingText and counter; the trigger's root, leading, text, tools and trailing. sendIcon and closeIcon replace the icons.
  • MessageFieldFrame is everything around the text, exported so another text box can sit inside it (useMessageFieldInput); MessageField is the frame with a <textarea>, and RichMessageField the frame with formatting.
Message field tokens
VariableDefaultPaints
--wm-message-field-containervar(--md-sys-color-surface-container-high)Varies with variant.The field’s background.
--wm-message-field-contentvar(--md-sys-color-on-surface)Varies with variant.The text.
--wm-message-field-placeholdervar(--md-sys-color-on-surface-variant)Varies with variant.The placeholder, the banner’s text and the icons in the slots and tools.
--wm-message-field-outlinetransparentVaries with variant.The 1px border.
--wm-message-field-caretvar(--md-sys-color-primary)The text cursor.
--wm-message-field-focus-outlinevar(--md-sys-color-primary)The border of a focused outlined field, and of any field while files are dragged over it.
--wm-message-field-errorvar(--md-sys-color-error)The border while invalid, and the counter over the limit.
--wm-message-field-disabled-containercolor-mix(in srgb, var(--md-sys-color-on-surface) calc(var(--md-sys-state-disabled-container-opacity) * 100%), transparent)Varies with variant.The background while disabled.
--wm-message-field-disabled-contentcolor-mix(in srgb, var(--md-sys-color-on-surface) calc(var(--md-sys-state-disabled-content-opacity) * 100%), transparent)The text, placeholder and icons while disabled.
--wm-message-field-disabled-outlinetransparentVaries with variant.The border while disabled.
--wm-message-field-labelvar(--md-sys-color-on-surface-variant)The visible label above the field.
--wm-message-field-supporting-textvar(--md-sys-color-on-surface-variant)The supporting text under the field.
--wm-message-field-countervar(--md-sys-color-on-surface-variant)The character counter.
--wm-message-field-send-colorvar(--md-sys-color-primary)The send icon with `sendVariant="standard"`.
--wm-message-field-cornervar(--md-sys-shape-corner-full)One line’s corners, capped at half the height (a pill by default).
--wm-message-field-grown-cornervar(--md-sys-shape-corner-extra-large)The corners once the field grows: wrapped text, a row, or open. Inside a container with corners of its own (a dialog, a card, a sheet), set a smaller one than the container’s, such as `large`.
--wm-message-field-docked-cornervar(--md-sys-shape-corner-none)The corners while `docked`.
--wm-message-field-pressed-cornervar(--md-sys-shape-corner-medium)Varies with size.MessageFieldTrigger’s corners while pressed.
--wm-message-field-height48pxVaries with size.The one-line height, the border included.
--wm-message-field-padding-inline16pxVaries with size.Between the edge and the text when no slot is there.
--wm-message-field-gap8pxVaries with size.Between a slot and the text.
--wm-message-field-slot-gap8pxVaries with size.Between the items of a slot or the tools: 48px less the buttons’ height, so their 48px touch targets don’t overlap.
--wm-message-field-button-extent40pxVaries with size.The slot buttons’ height, which centres them on one line. Set it with the buttons’ size.
--wm-message-field-text-fontvar(--md-sys-typescale-body-large-font)Varies with size.The text’s typeface.
--wm-message-field-text-sizevar(--md-sys-typescale-body-large-size)Varies with size.The text’s size.
--wm-message-field-text-line-heightvar(--md-sys-typescale-body-large-line-height)Varies with size.The text’s line height.
--wm-message-field-text-trackingvar(--md-sys-typescale-body-large-tracking)Varies with size.The text’s letter spacing.
--wm-message-field-text-weightvar(--md-sys-typescale-body-large-weight)Varies with size.The text’s weight.
--wm-message-field-spring-durationvar(--md-sys-motion-spring-spatial-default-duration)How long growing, shrinking, opening and docking take (follows the motion scheme).
--wm-message-field-spring-easingvar(--md-sys-motion-spring-spatial-default-easing)Their spring curve.
--wm-message-field-shrink-easingvar(--md-sys-motion-spring-effects-default-easing)The curve as the text box gets shorter (over the same duration): the effects spring, which never overshoots, so the text is never clipped and bounced back.
--wm-message-field-label-padding-inline16pxThe visible label’s inset from the field’s start edge.
--wm-message-field-label-gap4pxBetween the visible label and the field.
--wm-message-field-supporting-padding-inline16pxThe supporting text, error and counter’s inset from the field’s edges.
--wm-message-field-supporting-gap4pxBetween the field and the supporting text, error and counter under it.
--wm-message-field-counter-gap16pxBetween the supporting text and the counter.
--wm-message-field-row-padding-top4pxAbove the banner, and above the formatting row when it’s on top.
--wm-message-field-banner-min-height44pxThe banner row’s least height (“Replying to …”).
--wm-message-field-attachments-padding8pxAround the attachments row, at its sides and above it.
--wm-message-field-icon-size24pxMessageFieldTrigger’s trailing icon (M3’s 24px icon).

The suggestion list carries the core menu's tokens, and its container, corner and label-color default to the --md-comp-menus-* ones, so an app's menu theme reaches it too; its rows follow density as the core menu's do. Its own tokens are these (mentionListTokenSet from @windmorph/react-pro/rich-text). It renders in a popover outside the field, so set them on :root or a theme wrapper, or for one field in the classNames.list of mentions, tags or the emoji source (for example [--wm-mention-list-corner:8px]). Each classNames also reaches item, avatar, icon, label, description and loading.

Suggestion list tokens
VariableDefaultPaints
--wm-mention-list-containervar(--_md-comp-menus-container-color)The list’s background: the core menu’s container colour.
--wm-mention-list-cornervar(--_md-comp-menus-container-shape)The list’s corners: the core menu’s container shape.
--wm-mention-list-padding4pxBetween the list’s edge and its suggestions.
--wm-mention-list-max-heightcalc(5.5 * (56px + var(--md-sys-density, 0) * 4px) + 8px)How tall it grows: five and a half suggestions, so a cut-off one shows there’s more (rows lose 4px a density step).
--wm-mention-list-one-line-max-heightcalc(5.5 * (44px + var(--md-sys-density, 0) * 4px) + 8px)How tall it grows when no row has a second line (emoji, most tags): five and a half rows.
--wm-mention-list-item-cornervar(--md-sys-shape-corner-medium)The first and last suggestion’s outer corners, nested in the list’s (16 − 4).
--wm-mention-list-item-corner-innervar(--md-sys-shape-corner-extra-small)The corners between suggestions.
--wm-mention-list-item-min-heightcalc(44px + var(--md-sys-density, 0) * 4px)A suggestion’s least height: the core menu item’s, 44px at density 0 and 4px less a step (32px at −3).
--wm-mention-list-item-padding-inline12pxInside a suggestion’s row, at its sides.
--wm-mention-list-item-padding-blockcalc(8px + var(--md-sys-density, 0) * 2px)Inside a suggestion’s row, above and below, when it has a description: 8px, 2px less a density step, as the core menu’s.
--wm-mention-list-avatar-gap12pxBetween a person’s avatar and the label.
--wm-mention-list-icon-size24pxThe box of a tag’s icon, an emoji or a custom emoji’s image.
--wm-mention-list-icon-colorvar(--md-sys-color-on-surface-variant)A tag’s icon.
--wm-mention-list-emoji-font"Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", "Segoe UI Symbol", sans-serifThe emoji’s typeface: each platform’s colour emoji font, as the emoji picker’s.
--wm-mention-list-emoji-size20pxThe emoji’s size.
--wm-mention-list-label-colorvar(--_md-comp-menus-menu-item-label-text-color)The label (a name, a tag, an emoji’s shortcode): the core menu item’s label colour.
--wm-mention-list-label-fontvar(--md-sys-typescale-label-large-font)The label’s typeface.
--wm-mention-list-label-sizevar(--md-sys-typescale-label-large-size)The label’s size.
--wm-mention-list-label-line-heightvar(--md-sys-typescale-label-large-line-height)The label’s line height.
--wm-mention-list-label-weightvar(--md-sys-typescale-label-large-weight)The label’s weight.
--wm-mention-list-description-colorvar(--md-sys-color-on-surface-variant)The second line (`@username · Friend`).
--wm-mention-list-description-fontvar(--md-sys-typescale-body-medium-font)The second line’s typeface.
--wm-mention-list-description-sizevar(--md-sys-typescale-body-medium-size)The second line’s size.
--wm-mention-list-description-weightvar(--md-sys-typescale-body-medium-weight)The second line’s weight.
--wm-mention-list-description-line-heightvar(--md-sys-typescale-body-medium-line-height)The second line’s line height.
--wm-mention-list-active-layervar(--md-sys-color-on-surface)The highlight on the active suggestion: this colour at the hover state layer’s opacity.