Skip to content
IndexRequest a UIAboutContact

Reaction Picker

A like button that opens a tray of emoji reactions, each growing under the pointer.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Create a "Like" button (38px tall, pill) with a reaction tray above it containing five emoji buttons (Like 👍, Love ❤️, Laugh 😂, Wow 😮, Sad 😢), each 40px with an aria-label. The tray opens on hover over the button or tray, on focus-within and when the main button is clicked; it closes after 250ms when the pointer leaves, on Escape and after choosing. When opening, the tray fades and scales from 0.9 in 160ms and the emoji pop in with a 30ms stagger. Hovering an emoji scales it to 1.35 in 120ms. Choosing a reaction closes the tray and changes the main button to show that emoji and its name ("Love"), set aria-pressed true; clicking the main button while a reaction is set removes it. Keyboard: Arrow keys move between reactions. Under prefers-reduced-motion use a plain 120ms fade without scale or stagger.

About this pattern

Definition

A button that reveals a row of reactions on hover, focus or click. Hovering a reaction enlarges it, and choosing one replaces the button's label.

Purpose & UX principles

  • Offers a range of responses behind one familiar control.
  • The tray opens on hover for pointer users, and on click or focus for touch and keyboard users.
  • Every reaction is a labelled button; the chosen reaction is shown in text as well as emoji.

Interaction states

  • No reaction, tray open, hovered reaction (enlarged), chosen, focus-visible.

Motion specification

  • Tray: fade and scale from 0.9, 160ms. Reactions pop in with a 30ms stagger.
  • Hovered reaction scales to 1.35 in 120ms.
  • Reduced motion: the tray fades only, with no scaling or stagger.

Responsive behaviour

  • Reactions are 40px targets; the tray is horizontal and stays inside the container.
  • On touch, tapping the main button toggles the tray.

Code

HTML
<div class="rp" id="rp">
  <div class="tray" id="tray" role="group" aria-label="Reactions" hidden>
    <button data-n="Like" aria-label="Like" style="--i:0">👍</button><button data-n="Love" aria-label="Love" style="--i:1">❤️</button><button data-n="Laugh" aria-label="Laugh" style="--i:2">😂</button><button data-n="Wow" aria-label="Wow" style="--i:3">😮</button><button data-n="Sad" aria-label="Sad" style="--i:4">😢</button>
  </div>
  <button class="main" id="main" aria-pressed="false" aria-haspopup="true"><span id="mi">👍</span> <span id="ml">Like</span></button>
</div>

Related patterns

Icon Button

↗
Icon ButtonButtons & Actions

Double Tap to Like

↗
Double Tap to LikeGestures & Touch

Dropdown Menu

↗
Dropdown MenuOverlays & Dialogs