Skip to content

Reaction picker

Pro

A 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.

Keyboard

Reaction picker keyboard
KeyAction
Enter or SpaceToggles the reaction: picks the default option when there is none, or removes the one picked.On the button
Arrow Up or Alt + Arrow DownOpens the row with focus on the picked reaction, or on the first.On the button
Arrow Left or Arrow RightMoves to the previous or next reaction, wrapping from the last to the first.In the row
Home or EndMoves to the first or last reaction.In the row
Enter or SpacePicks the focused reaction, closes the row and returns focus to the button.In the row
EscapeCloses the row and returns focus to the button.In the row
Tab or Shift + TabCloses the row and leaves it as if it sat right after the button: Shift + Tab lands on the button, Tab on whatever follows it.In the row
  • Left and right are reversed in right-to-left layouts.
  • The pointer ways to open the row (a long press, or resting the mouse on the button) all have this keyboard equivalent.

Screen reader

Role
The button is a toggle button. The row is a toolbar of buttons.
Accessible name
The button is named by the reaction it shows: the picked one, or the default option. Each option is named by its label; the row by labels.reactions ("Reactions").
States announced
The button is pressed or not pressed (aria-pressed), expanded or collapsed (aria-expanded, with aria-controls pointing at the row while it shows), and describes how to open the row with labels.openPicker ("Press and hold, or press Alt + Arrow Down, for more reactions").
  • The icons, and the name shown above the active option on the core's plain tooltip surface, are hidden from assistive tech (aria-hidden); the option's name already says it.
  • In the row, the picked reaction is pressed (aria-pressed="true") as well as filled with secondary-container.

Focus

  • The button is one Tab stop. A keyboard open moves focus into the row, and closing it with Escape or a keyboard pick puts focus back on the button at once, without scrolling the page.
  • Focus isn't trapped: the row is a non-modal popover, and a press anywhere else closes it. Picking with a pointer leaves focus where it was.
  • Keyboard focus shows M3's focus indicator on the button and on each option: a 3px secondary outline 2px outside.

Touch target

  • The button is 40px tall (md) or 32px (sm), with an invisible 48 × 48px touch target (TouchTarget). Each option in the row is 48 × 48px.
  • On touch, a long press opens the row and sliding the finger along it then lifting picks the reaction under it.

Motion

  • Under reduced motion the row only fades in and out instead of also scaling from 80%, and the active option is shown at 1.5× at once instead of growing.
  • The press ripple appears at full size without growing, and corner changes snap; colours still fade.

What you need to do

  • Give every option a label in the app's language: it is the option's name, its tooltip and the button's label once picked.
  • Translate labels.openPicker and labels.reactions.
  • Pick each reaction's color from REACTION_COLORS: the types accept only those roles, each with 4.5:1 on the button and the row.
  • In forced-colours mode the button keeps a 1px boundary (Highlight when picked, GrayText when disabled), the row keeps a border, and the picked option uses Highlight; keep classNames overrides from removing them.