Message field
ProA 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
MessageField 70 props
The text (controlled).
The text at first (uncontrolled).
When Enter sends:
enter(Shift+Enter is a new line),mod-enter(Ctrl/⌘+Enter) ornone(only the send button). On touch screens Enter is always a new line.Clear the text after
onSubmit. Otherwise the app clears it once the send succeeds.Hint inside the field. Never the only name: give a
labeloraria-labeltoo.The height the field keeps when the text is shorter, in lines.
Rows after which the text scrolls inside the field.
Focuses the text when the field appears, starting it open with
expandOnFocus.The form field name.
The id of the
<form>the field belongs to, when it isn't inside it.The
<textarea>.Mentions:
@and a name suggest people fromsearch(the app decides who and in what order), and choosing one puts@Namein 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.Emoji:
:and two letters (:sm) suggest emoji, and choosing one puts it in place of:sm. Built bycreateEmojiSuggestionsfrom@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.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
maxLengthnever sends.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.Show the send button.
filled: a filled circle, as the search bar's action.standard: the icon alone, in thesend-colortoken (primary), a quieter Send beside icon tools.Replaces the send icon.
Shown in Send's place while there's nothing to send, e.g. a microphone button.
Helper text under the field.
Shown under the field, in the error roles, while
invalid; announced when it appears.Marks the field invalid. A send that ends while invalid shakes the field once.
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
maxlengthisn'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.Always show the counter (with
maxLength), not only fromcounterThreshold.The share of
maxLength(0–1) from which the counter shows and is announced.One-line height:
sm40px,md48px,lg56px.The container:
filled(surface-container-high),tonal(secondary-container) oroutlined(a transparent pill with anoutlineborder).Before the text, centred on its first line: an avatar or icon buttons.
Icon buttons after the text, before Send.
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.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.
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.Where the tools are while the field is closed (
expandOnFocus).Replaces the banner's close icon.
A row of controls inside the open field, such as formatting buttons. It opens the field.
Where the
toolbarrow 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.A row of content above the text inside the field, such as
MediaUploadGrid.File types
onFileAccepttakes: 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 isapplication/vnd.ms-excelwhere a spreadsheet app owns the extension), so list the extensions too:['text/csv', '.csv'].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-opendocks once the field opens (expandOnFocus) and stays docked, as it stays open. Where it sits is the app's (classNameandclassNames.field, whichdata-dockedstyles).The field must be filled in (
aria-required); the label gets an asterisk.Disables the field, its slots and its tools.
The text can be read and selected but not changed; Send hides.
insertText,focusandclear, for the app.The root element.
The
<textarea>'s id.enterKeyHinttype"enter" | "done" | "go" | "next" | "previous" | "search" | "send"default"send" where Enter sends, else the browser'sThe on-screen keyboard's Enter key.
Whether the browser checks the spelling.
The
<textarea>'sautocomplete.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.
The visible label above the field. Give it,
aria-labeloraria-labelledby: the placeholder is never the only name.
Events
Called with the text as it changes.
Called with the trimmed text on Enter (see
submitOn) or the send button, while there's something to send and the text is withinmaxLength.Escape in the field, e.g. to cancel a reply.
Shows a close button on the banner, e.g. to cancel the reply.
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 (
acceptedis empty when every file was refused,rejectedwhen none was). Called first, thenonFileAcceptandonFileReject, 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.Called with files pasted or dropped onto the field that match
accept. Without it oronFilePick, files are ignored.Called with the files a paste or drop brought that don't match
accept(reasontype), afteronFileAccept; never with an empty list. Only while the field takes files (onFileAcceptoronFilePick, 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).Called when the text gets focus.
Called when the text loses focus.
Text
Every word the field says, from the app's translations (each key's default is on
MessageFieldLabels). ALabelsProvidersets them for the whole app.The send button's name and tooltip.
Added to Send's name while
pending("Send, Sending"), and announced politely when a send starts.The banner's close button.
labels.countertype(count: number, max: number) => stringdefault"1,840 / 2,000", in the locale's digitsThe visible counter.
The tools toolbar's name.
The list of people
@suggests (withmentions).The list's loading indicator, while a search for people runs a while.
What the list's status says.
The list of tags
#suggests (withtags).The list's loading indicator, while a search for tags runs a while.
What the tag list's status says.
The list of emoji
:suggests (withemojiSuggestions).The list's loading indicator, while the emoji data loads.
What the emoji list's status says.
labels.nearLimittype(left: number) => stringdefault (left) =>${left} characters left("1 character left")Announced once the counter's threshold is reached.
Announced when the text reaches
maxLength.labels.overLimittype(over: number) => stringdefault (over) =>${over} characters over the limit("1 character over the limit")Announced when the text goes over
maxLength.
More ids describing the text, after the supporting text and error.
The id of an element with more details about the field.
Names the field for screen readers when there's no visible
label, e.g. "Write a comment".The id of a visible element that names the field, instead of
label.
Classes for the root; consumer classes always win.
Classes for each part, merged after the defaults.
The root, holding the label, the field and the supporting text; merged with
className.The visible
label.The rounded field holding the rows and the text.
The toolbar row's content (a formatting row).
The attachments row's content.
The panel slot below the field, where a tool can dock (the emoji picker on phones).
The panel slot above the field (before its label), where a tool can dock from the medium window size (the emoji picker on a computer), taking the room of what's above the field. In the page only while a tool is docked there.
The
leadingslot (before the text).The text box: the
<textarea>or the rich editor.The
toolstoolbar.The
trailingslot, holdingtrailingand Send oremptyAction.The send button's parts.
The cell holding
emptyAction.The supporting text or error message.
The visible character counter.
Inline styles for the root, e.g. a
--wm-message-field-*token.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
MessageFieldFrame 51 props
The text box: it reads
useMessageFieldInputand registers itstextBoxRef.Characters in the text as people see them, for the counter and the limit: count grapheme clusters (
Intl.Segmenter), asMessageFieldandRichMessageFielddo, notvalue.length.The text is blank.
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
maxLengthnever sends.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.Show the send button.
filled: a filled circle, as the search bar's action.standard: the icon alone, in thesend-colortoken (primary), a quieter Send beside icon tools.Replaces the send icon.
Shown in Send's place while there's nothing to send, e.g. a microphone button.
Helper text under the field.
Shown under the field, in the error roles, while
invalid; announced when it appears.Marks the field invalid. A send that ends while invalid shakes the field once.
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
maxlengthisn'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.Always show the counter (with
maxLength), not only fromcounterThreshold.The share of
maxLength(0–1) from which the counter shows and is announced.One-line height:
sm40px,md48px,lg56px.The container:
filled(surface-container-high),tonal(secondary-container) oroutlined(a transparent pill with anoutlineborder).Before the text, centred on its first line: an avatar or icon buttons.
Icon buttons after the text, before Send.
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.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.
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.Where the tools are while the field is closed (
expandOnFocus).Replaces the banner's close icon.
A row of controls inside the open field, such as formatting buttons. It opens the field.
Where the
toolbarrow 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.A row of content above the text inside the field, such as
MediaUploadGrid.File types
onFileAccepttakes: 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 isapplication/vnd.ms-excelwhere a spreadsheet app owns the extension), so list the extensions too:['text/csv', '.csv'].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-opendocks once the field opens (expandOnFocus) and stays docked, as it stays open. Where it sits is the app's (classNameandclassNames.field, whichdata-dockedstyles).The field must be filled in (
aria-required); the label gets an asterisk.Disables the field, its slots and its tools.
The text can be read and selected but not changed; Send hides.
insertText,focusandclear, for the app.The root element.
The visible label above the field. Give it,
aria-labeloraria-labelledby: the placeholder is never the only name.The height the field keeps when the text is shorter, in lines.
The text box's id.
Events
Shows a close button on the banner, e.g. to cancel the reply.
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 (
acceptedis empty when every file was refused,rejectedwhen none was). Called first, thenonFileAcceptandonFileReject, 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.Called with files pasted or dropped onto the field that match
accept. Without it oronFilePick, files are ignored.Called with the files a paste or drop brought that don't match
accept(reasontype), afteronFileAccept; never with an empty list. Only while the field takes files (onFileAcceptoronFilePick, 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).Send pressed, or Enter (
requestSend), while there's something to send.
Text
Every word the field says, from the app's translations (each key's default is on
MessageFieldLabels). ALabelsProvidersets them for the whole app.The send button's name and tooltip.
Added to Send's name while
pending("Send, Sending"), and announced politely when a send starts.The banner's close button.
labels.countertype(count: number, max: number) => stringdefault"1,840 / 2,000", in the locale's digitsThe visible counter.
The tools toolbar's name.
The list of people
@suggests (withmentions).The list's loading indicator, while a search for people runs a while.
What the list's status says.
The list of tags
#suggests (withtags).The list's loading indicator, while a search for tags runs a while.
What the tag list's status says.
The list of emoji
:suggests (withemojiSuggestions).The list's loading indicator, while the emoji data loads.
What the emoji list's status says.
labels.nearLimittype(left: number) => stringdefault (left) =>${left} characters left("1 character left")Announced once the counter's threshold is reached.
Announced when the text reaches
maxLength.labels.overLimittype(over: number) => stringdefault (over) =>${over} characters over the limit("1 character over the limit")Announced when the text goes over
maxLength.
Names the field for screen readers when there's no visible
label, e.g. "Write a comment".The id of a visible element that names the field, instead of
label.More ids describing the text box, after the supporting text and error.
The id of an element with more details about the field.
Classes for the root; consumer classes always win.
Classes for each part, merged after the defaults.
The root, holding the label, the field and the supporting text; merged with
className.The visible
label.The rounded field holding the rows and the text.
The toolbar row's content (a formatting row).
The attachments row's content.
The panel slot below the field, where a tool can dock (the emoji picker on phones).
The panel slot above the field (before its label), where a tool can dock from the medium window size (the emoji picker on a computer), taking the room of what's above the field. In the page only while a tool is docked there.
The
leadingslot (before the text).The text box: the
<textarea>or the rich editor.The
toolstoolbar.The
trailingslot, holdingtrailingand Send oremptyAction.The send button's parts.
The cell holding
emptyAction.The supporting text or error message.
The visible character counter.
Inline styles for the root, e.g. a
--wm-message-field-*token.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
MessageFieldTrigger 17 props
The prompt, such as "What's on your mind?". It names the button.
Before the prompt, usually the person's avatar. Decorative: the prompt names the button.
An icon after the prompt, such as a photo icon. Decorative, and never a second button.
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.One-line height:
sm40px,md48px,lg56px, asMessageField.The container, as the field it opens into:
filled(surface-container-high),tonal(secondary-container) oroutlined(a transparent pill with anoutlineborder).Disables the button or link.
The button's or link's id.
Renders a link to the composer's page instead of a button.
Ref to the root element: the
<button>, or the<a>withhref.
Text
Overrides the prompt as the accessible name.
The id of the element that names the trigger, instead of the prompt.
Ids of elements that describe the trigger.
Classes for the root; consumer classes always win.
Classes for each part, merged after the defaults.
Inline styles for the root, e.g. a
--wm-message-field-*token.
MessageFieldSend 11 props
filled: a filled circle, as the search bar's action.standard: the icon alone, in thesend-colortoken (primary).Replaces the Material Symbols
sendicon; mirrored in right-to-left text.The send is in flight: presses are ignored, the button's name gains
labels.sending, and the coreIconButton's loading indicator takes the icon's place after 200ms, so a quick send doesn't flash.Disables the button (nothing to send).
The button's id.
The
<button>.
Text
Its words: the button's name, and what it adds while
pending. ALabelsProvidersets them for the whole app.
Classes for the icon button; consumer classes always win.
Classes for each part, merged after the defaults.
Inline styles for the button.
Types
MentionSuggestionsOptions 3 fields
How a field suggests people after @.
searchtype(query: string, options: SuggestionSearchOptions) => readonly MentionSuggestion[] | Promise<readonly MentionSuggestion[]>RequiredThe people for what's typed after
@, best first; may be async, and is given asignalaborted once the answer is no longer wanted. A failed search shows nobody.How many people the list shows at most.
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 #.
searchtype(query: string, options: SuggestionSearchOptions) => readonly TagSuggestion[] | Promise<readonly TagSuggestion[]>RequiredThe tags for what's typed after
#(without it), best first; may be async, and is given asignalaborted once the answer is no longer wanted. A failed search shows none.How many tags the list shows at most.
Classes for the list's parts (and its tokens, as the list renders outside the field).
MentionSuggestion 4 fields
Someone the field suggests after @.
Stored in the rich field's text:
<@id|label>.The name the mention shows, as written.
A second line, e.g.
@usernameor "Friend".avatartypestring | 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 #.
Stored in the rich field's text:
<#id|label>.The tag as written, without
#("design").A second line, e.g. how many posts use it.
icontypestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<AwaitedReactNode>Shown before the tag.
Hooks
useMessageField
For a tool in the field's tools: insert text at the caret, or focus the text.
Returns MessageFieldContextValue
The field is open (
expandOnFocus): the tools are on their own row.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.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).Empties the text.
useMessageFieldInput
useMessageFieldInput(): MessageFieldInputContextValueFor a text box inside MessageFieldFrame: its attributes, classes and the frame's send.
Returns MessageFieldInputContextValue
fieldPropstypeReact.DOMAttributes<HTMLElement> & React.AriaAttributes & { id?: string | undefined; }RequiredSpread 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…).The
inputslot's classes, for the text box element.The text box registers itself here (
useImperativeHandle).Enter's send: sends when the frame would (there's something, not over the limit).
The field is open (
expandOnFocus).The field's size.
The field is invalid (
invalid, or overmaxLength).The field is disabled.
The field is read-only.
The field is required.
useCoarsePointer
useCoarsePointer(): booleanWhether 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.
| Item | Status | Details |
|---|---|---|
| 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. |
Variants: filled, tonal and outlined
BuiltVariant · Variants
Sizes: sm, md and lg
BuiltConfiguration · Variants
Opens on focus, with tools and a standard Send
BuiltConfiguration · Comment
Reply banner, attachments and an empty action
BuiltConfiguration · Chat
Docked as a footer
BuiltConfiguration · Docked
Character limit, label, supporting text and error
BuiltConfiguration · Limit
Send on Ctrl or ⌘ + Enter
BuiltConfiguration · Limit
Suggestions while typing: people, tags and emoji (
Builtmentions,tags,emojiSuggestions)Configuration · Suggestions
A trigger that opens a composer (
BuiltMessageFieldTrigger)Use case · Trigger
Built on the M3 search bar and text field
ExtensionA 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) oroutlined(anoutlineborder,primarywhile focused). The tonal placeholder ison-surface-variant, quieter than the text, and switches toon-secondary-containerat medium and high contrast so it keeps 4.5:1 (an app's--wm-message-field-placeholderstill wins). Disabled colours use the system disabled opacities.size:sm40px (body-medium),md48px andlg56px (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 ordinaryIconButtons, so a theme reaches them as it does any button, andclassNamesreaches each one. classNamesstyles theroot,label,field,banner,bannerClose,toolbar,attachments,leading,input,tools,trailing, the send button's parts (send.root,send.icon,send.glyph,send.loading),emptyAction,supportingTextandcounter; the trigger'sroot,leading,text,toolsandtrailing.sendIconandcloseIconreplace the icons.MessageFieldFrameis everything around the text, exported so another text box can sit inside it (useMessageFieldInput);MessageFieldis the frame with a<textarea>, andRichMessageFieldthe frame with formatting.
| Variable | Default | Paints |
|---|---|---|
--wm-message-field-container | var(--md-sys-color-surface-container-high)Varies with variant. | The field’s background. |
--wm-message-field-content | var(--md-sys-color-on-surface)Varies with variant. | The text. |
--wm-message-field-placeholder | var(--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-outline | transparentVaries with variant. | The 1px border. |
--wm-message-field-caret | var(--md-sys-color-primary) | The text cursor. |
--wm-message-field-focus-outline | var(--md-sys-color-primary) | The border of a focused outlined field, and of any field while files are dragged over it. |
--wm-message-field-error | var(--md-sys-color-error) | The border while invalid, and the counter over the limit. |
--wm-message-field-disabled-container | color-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-content | color-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-outline | transparentVaries with variant. | The border while disabled. |
--wm-message-field-label | var(--md-sys-color-on-surface-variant) | The visible label above the field. |
--wm-message-field-supporting-text | var(--md-sys-color-on-surface-variant) | The supporting text under the field. |
--wm-message-field-counter | var(--md-sys-color-on-surface-variant) | The character counter. |
--wm-message-field-send-color | var(--md-sys-color-primary) | The send icon with `sendVariant="standard"`. |
--wm-message-field-corner | var(--md-sys-shape-corner-full) | One line’s corners, capped at half the height (a pill by default). |
--wm-message-field-grown-corner | var(--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-corner | var(--md-sys-shape-corner-none) | The corners while `docked`. |
--wm-message-field-pressed-corner | var(--md-sys-shape-corner-medium)Varies with size. | MessageFieldTrigger’s corners while pressed. |
--wm-message-field-height | 48pxVaries with size. | The one-line height, the border included. |
--wm-message-field-padding-inline | 16pxVaries with size. | Between the edge and the text when no slot is there. |
--wm-message-field-gap | 8pxVaries with size. | Between a slot and the text. |
--wm-message-field-slot-gap | 8pxVaries 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-extent | 40pxVaries with size. | The slot buttons’ height, which centres them on one line. Set it with the buttons’ size. |
--wm-message-field-text-font | var(--md-sys-typescale-body-large-font)Varies with size. | The text’s typeface. |
--wm-message-field-text-size | var(--md-sys-typescale-body-large-size)Varies with size. | The text’s size. |
--wm-message-field-text-line-height | var(--md-sys-typescale-body-large-line-height)Varies with size. | The text’s line height. |
--wm-message-field-text-tracking | var(--md-sys-typescale-body-large-tracking)Varies with size. | The text’s letter spacing. |
--wm-message-field-text-weight | var(--md-sys-typescale-body-large-weight)Varies with size. | The text’s weight. |
--wm-message-field-spring-duration | var(--md-sys-motion-spring-spatial-default-duration) | How long growing, shrinking, opening and docking take (follows the motion scheme). |
--wm-message-field-spring-easing | var(--md-sys-motion-spring-spatial-default-easing) | Their spring curve. |
--wm-message-field-shrink-easing | var(--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-inline | 16px | The visible label’s inset from the field’s start edge. |
--wm-message-field-label-gap | 4px | Between the visible label and the field. |
--wm-message-field-supporting-padding-inline | 16px | The supporting text, error and counter’s inset from the field’s edges. |
--wm-message-field-supporting-gap | 4px | Between the field and the supporting text, error and counter under it. |
--wm-message-field-counter-gap | 16px | Between the supporting text and the counter. |
--wm-message-field-row-padding-top | 4px | Above the banner, and above the formatting row when it’s on top. |
--wm-message-field-banner-min-height | 44px | The banner row’s least height (“Replying to …”). |
--wm-message-field-attachments-padding | 8px | Around the attachments row, at its sides and above it. |
--wm-message-field-icon-size | 24px | MessageFieldTrigger’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.
| Variable | Default | Paints |
|---|---|---|
--wm-mention-list-container | var(--_md-comp-menus-container-color) | The list’s background: the core menu’s container colour. |
--wm-mention-list-corner | var(--_md-comp-menus-container-shape) | The list’s corners: the core menu’s container shape. |
--wm-mention-list-padding | 4px | Between the list’s edge and its suggestions. |
--wm-mention-list-max-height | calc(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-height | calc(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-corner | var(--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-inner | var(--md-sys-shape-corner-extra-small) | The corners between suggestions. |
--wm-mention-list-item-min-height | calc(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-inline | 12px | Inside a suggestion’s row, at its sides. |
--wm-mention-list-item-padding-block | calc(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-gap | 12px | Between a person’s avatar and the label. |
--wm-mention-list-icon-size | 24px | The box of a tag’s icon, an emoji or a custom emoji’s image. |
--wm-mention-list-icon-color | var(--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-serif | The emoji’s typeface: each platform’s colour emoji font, as the emoji picker’s. |
--wm-mention-list-emoji-size | 20px | The emoji’s size. |
--wm-mention-list-label-color | var(--_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-font | var(--md-sys-typescale-label-large-font) | The label’s typeface. |
--wm-mention-list-label-size | var(--md-sys-typescale-label-large-size) | The label’s size. |
--wm-mention-list-label-line-height | var(--md-sys-typescale-label-large-line-height) | The label’s line height. |
--wm-mention-list-label-weight | var(--md-sys-typescale-label-large-weight) | The label’s weight. |
--wm-mention-list-description-color | var(--md-sys-color-on-surface-variant) | The second line (`@username · Friend`). |
--wm-mention-list-description-font | var(--md-sys-typescale-body-medium-font) | The second line’s typeface. |
--wm-mention-list-description-size | var(--md-sys-typescale-body-medium-size) | The second line’s size. |
--wm-mention-list-description-weight | var(--md-sys-typescale-body-medium-weight) | The second line’s weight. |
--wm-mention-list-description-line-height | var(--md-sys-typescale-body-medium-line-height) | The second line’s line height. |
--wm-mention-list-active-layer | var(--md-sys-color-on-surface) | The highlight on the active suggestion: this colour at the hover state layer’s opacity. |