Reaction summary
ProThe reactions so far: the top kinds’ icons and how many, stacked under a post or as a chip in a comment; pressable to see who reacted. Not an M3 component (@windmorph/react-pro).
import { ReactionSummary } 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
ReactionSummary 13 props
The top kinds, most first.
How many reactions in all. Nothing renders at 0.
stacked(under a post) orchip(at the end of a comment's actions).How many icons show, e.g. 1 in a narrow row.
smfor comments and messages,mdfor posts. It sets the icons' size, astackedcount's type (label-large,label-mediumatsm) and a pressablestackedsummary's height and padding (40px and 12px, 32px and 8px atsm): the reaction picker's at the same size, so the two sit level in one row.The root element: a
<button>when pressable, otherwise a<span>.The root element's id.
Text
Every word the summary says, from the app's translations. Each key's default is on
ReactionSummaryLabels. ALabelsProvidersets them for the whole app.labels.counttype(total: number, formatted: string) => stringdefault"1 reaction" / "128 reactions" / "1.3K reactions"How many, in words: the button's name when pressable, otherwise read by screen readers.
formattedis the number as shown (the locale's compact form, "1.3K"); put it in the words, so a pressable summary's name contains its visible text (WCAG 2.5.3, "Label in Name").
More ids describing the summary.
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-reaction-summary-*token.
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.
Theming & tokens
Set the tokens below on a summary or any ancestor; match --wm-reaction-summary-icon-ring to the surface it sits on. A chip also carries the assist chip's tokens (data-tokens="md-comp-assist-chip wm-reaction-summary"), so an app's chip theme reaches it; chip-container defaults to transparent and chip-corner to the small corner, as M3's flat chip. Style the parts with classNames (root, icons, icon, count).
| Variable | Default | Paints |
|---|---|---|
--wm-reaction-summary-icon-size | 24pxVaries with size. | Each reaction icon’s circle (`stacked`). |
--wm-reaction-summary-icon-font-size | 16pxVaries with size. | An emoji icon’s size inside it: `body-large`’s 16px (14px, `body-medium`’s, at `sm`), in px like the circle, so 200% text never covers it. |
--wm-reaction-summary-icon-container | var(--md-sys-color-surface-container-highest) | Behind each icon (`stacked`). |
--wm-reaction-summary-icon-ring | var(--md-sys-color-surface-container) | The ring that separates overlapping icons; match the surface below. |
--wm-reaction-summary-icon-ring-width | 2px | Its width. |
--wm-reaction-summary-icon-overlap | 4px | How far each icon overlaps the one before. |
--wm-reaction-summary-chip-container | transparent | The chip’s background (`chip`): none, as M3’s flat chips. |
--wm-reaction-summary-chip-corner | var(--md-sys-shape-corner-small) | The chip’s corners: 8px, as every M3 chip. |
--wm-reaction-summary-count-color | var(--md-sys-color-on-surface-variant) | The count. |
--wm-reaction-summary-gap | 4px | Between the icons and the count. |
--wm-reaction-summary-button-height | 40pxVaries with size. | A pressable `stacked` summary’s height: the reaction picker’s, 32px at `sm` (its touch target is 48px). |
--wm-reaction-summary-button-padding-inline | 12pxVaries with size. | Inside a pressable `stacked` summary, at its sides: the reaction picker’s, 8px at `sm`. |