Reaction picker
ProA reaction button that likes on tap, with a floating row of reactions on long press, hover or the keyboard; slide a finger along it to pick. Not an M3 component (@windmorph/react-pro).
import { ReactionPicker } 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
ReactionPicker 19 props
The reactions, in row order.
The id a plain tap picks.
The picked reaction's id, or
nullfor none (controlled).The reaction picked at first (uncontrolled).
Whether the row is open (controlled).
Whether the row is open at first (uncontrolled).
Disables the button (and closes the row).
smfor comments and messages,mdfor posts.text, transparent;tonal, on a pill (a post's action row).Whether the button shows the default option's icon before a reaction.
false: a word ("Like") until there is one, as under a comment.The button element.
The button's id.
Events
Called with the new reaction's id, or
nullwhen the reaction is removed.Called when the row opens or closes.
Text
Every word the component says, from the app's translations. Each key's default is on
ReactionPickerLabels. ALabelsProvidersets them for the whole app.More ids describing the button, e.g. a count of reactions shown beside it.
Classes for the button (the root); consumer classes always win.
Classes for each part, merged after the defaults (the row renders in a popover).
Merged onto the button, e.g. a
--wm-reaction-picker-*token.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
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 |
|---|---|---|
| Text button | Built | Variant · Variants |
| Tonal button | Built | Variant · Variants |
| Size: small and medium | Built | Configuration · Variants, Message |
| No icon before reacting | Built | Configuration · Variants |
| A post's action bar | Built | Use case · Post |
| Reacting to a message, translated | Built | Use case · Message |
M3 Expressive specs
- Sizes
sm, md- Shape
rounded-corner-full
Theming & tokens
- The button is transparent (
tonal: asurface-container-highpill) withon-surface-variantcontent, and the picked option'scoloronce picked. Disabled, it takes the system disabled-content opacity; in forced colours it keeps a 1px boundary (Highlightwhen picked). - The row is a
surface-container-highpill at elevation 3. It scales and fades in from its anchor on the default spatial spring, and the option under the pointer grows 1.5× on the fast spatial spring. Under reduced motion the row only fades, and the option is shown at 1.5× at once. - Set the tokens below on
:root, a theme wrapper, the button orclassNames.row: the button and the portalled row both carrydata-tokens="wm-reaction-picker", so the row's tokens reach it from outside. Emoji take type-scale sizes in px, so 200% text keeps them in their boxes. classNamesstyles thebutton,icon,label,rowand eachoption;reactionPickerStylescan be extended with new variants.
| Variable | Default | Paints |
|---|---|---|
--wm-reaction-picker-label-color | var(--md-sys-color-on-surface-variant) | The button’s icon and label with no reaction picked. |
--wm-reaction-picker-tonal-container-color | var(--md-sys-color-surface-container-high) | The button’s pill in the `tonal` variant. |
--wm-reaction-picker-height | 40pxVaries with size. | The button’s height (32px at `sm`). |
--wm-reaction-picker-padding-inline | 12pxVaries with size. | Inside the button, at its sides (8px at `sm`). |
--wm-reaction-picker-gap | 8pxVaries with size. | Between the button’s icon and label (4px at `sm`). |
--wm-reaction-picker-icon-size | 20pxVaries with size. | The button’s icon box (18px at `sm`). |
--wm-reaction-picker-icon-font-size | 16pxVaries with size. | An emoji’s size in the button: `body-large`’s 16px (14px, `body-medium`’s, at `sm`), in px like its box, so 200% text never spills it. |
--wm-reaction-picker-row-container-color | var(--md-sys-color-surface-container-high) | The floating row’s background. |
--wm-reaction-picker-row-elevation | var(--md-sys-elevation-level-3) | The floating row’s shadow. |
--wm-reaction-picker-row-corner | var(--md-sys-shape-corner-full) | The floating row’s corners. |
--wm-reaction-picker-row-padding | 4px | Between the row’s edge and its options. |
--wm-reaction-picker-row-gap | 4px | Between the options. |
--wm-reaction-picker-option-size | 48px | Each option’s box, its touch target too: keep it 48px or more. |
--wm-reaction-picker-option-icon-size | 32pxVaries with size. | An option’s icon box at rest; it grows 1.5× when active (28px at `sm`). |
--wm-reaction-picker-option-icon-font-size | 28pxVaries with size. | An emoji’s size in an option: `headline-medium`’s 28px (24px, `headline-small`’s, at `sm`), in px like its box. |
--wm-reaction-picker-option-current-container-color | var(--md-sys-color-secondary-container) | Behind the picked reaction’s option. |