Reactions

The room's pulse while someone talks. Phones tap a reaction (`ReactionBar`) and the shared screen lets it float up (`ReactionStream`); someone who wants to speak raises a hand (`RaiseHand`) and the host calls on people in the order they asked (`HandQueue`).

gamesclient≥ 320pxuiv1.0.0

Preview

Reactions — live rendergames-reactions--default ↗

Rendered from the story the storybook (a11y) CI gate runs axe against — the preview can't show something that hasn't been verified.

Install

Two equivalent paths — the URL works in any shadcn-CLI setup; the alias works once you've registered @interlace in your components.json.

Via shadcn URL
npx shadcn@latest add https://ds.interlace.tools/r/reactions.json
With the @interlace alias
npx shadcn@latest add @interlace/reactions

Behavior

What this component does — the keyboard path, the measured colour, the text equivalent and the states it can be in. Every figure below is read out of the test or the source that enforces it by scripts/build-behavior-map.mjs, so nothing here can outlive the gate that keeps it true.

Every semantic colour pair this component's own source uses, measured against the shipped hexes in all 4 theme × scheme combinations. The tightest is muted-foreground on background at 7.82:1 (harbor · light), against a floor of 4.5:1.

Measured WCAG contrast ratios per token pair and theme
PairinterlacelightinterlacedarkharborlightharbordarkFloor
muted-foreground on backgroundsecondary copy9.11:111.16:17.82:19.52:14.5:1SC 1.4.3
muted-foreground on cardsecondary copy in a card9.41:110.48:18.25:18.64:14.5:1SC 1.4.3
primary on backgroundtext-primary on the page8.52:111.63:18.39:110.03:14.5:1SC 1.4.3
primary on cardtext-primary in a card8.80:110.92:18.86:19.10:14.5:1SC 1.4.3
foreground on backgroundbody copy19.02:116.73:117.74:116.19:14.5:1SC 1.4.3

Text pairs are held to 4.5:1 (WCAG 2.2 SC 1.4.3); borders, rings and chart axes to 3:1 (SC 1.4.11 non-text). Bold is the worst cell in the row — the one a brand fork has to keep an eye on.

A chart's alt text is not a sentence about the chart — the equivalent of the data is the data. This is what a screen reader gets, read out of the source the install writes into your tree.

Label, not a data equivalentShips sr-only copy

Ships sr-only copy for what the visual carries by position, colour or icon alone — a label, not a full data equivalent.

Where it renders, how narrow it survives, and whether its lines are inside the coverage gate — three answers a consumer needs before the paste, not after the bug.

Render boundary
'use client'

Hydrates. It brings JavaScript to any route that imports it — put the boundary here, not at the page.

Minimum viewport
MIN_VIEWPORT = 320

Declared, not assumed. Below 320 CSS px the preflight contract draws a dev-mode outline — how to switch it on.

Coverage gate
not in the gate

The 100% gate currently covers src/charts/**/*.{ts,tsx} and pure cores: day keys, puzzle order, streak arithmetic. and , and , // DataTable: sort order, blanks last, page window, selection. and , // Photo upload: what a file is, what it says about its owner, the plan, the reducer. and , // The account control: names and initials, the return-path check, the reducer, the hook, the menu. and , and , and , // The five pure variant/model modules. and , // Booking: the slot picker and src/patterns/time-slot-model.ts and src/patterns/share-image-model.ts and src/patterns/{interest-model,commitment-model,session-plan-model,recap-model}.ts and src/primitives/{file-model.ts,file-drop.tsx} and src/patterns/avatar-upload.tsx and s first steps. and , // The 37 components with real render coverage. See the ledger above. and , // Patterns with full render coverage — the same ledger rule: a // file is in at 100 or it is out, and joining is a one-line diff. and , // Effects with full render coverage, on the same rule. and , . This file is outside it — the glob widens in phase 7.2.

History

This component is at v1.0.0, first shipped in @interlace/ui 2.0.0. The version is stamped as a banner into the file the install writes, so the copy in your tree says which one you have — compare it with the number above before deciding whether to re-run the install.

Unreleased11 entries

  • Changedpatch

    The Q&A board no longer pins or takes votes for a question whose asker has left. A host screen that still listed such a question could pin it; every screen hides it, so the visible pin was replaced by an invisible one, and a vote went to a question nobody can see. The room now refuses a pin or vote on a departed player's question as bad-action.

  • Changedpatch

    Raised hands no longer give the word to someone who has left. A host screen that still listed a departed player's hand could call them by name; the room accepted it, every screen then hid the speaker, and the person who really had the word was dropped. The room now refuses a named call for a player who is not in the room as bad-action; calling the next in line already skipped them.

  • Changedpatch

    Raised hands whose room has filled up no longer refuse every raise. They keep a hand for everyone who ever raised one, and a phone that rejoins gets a new id, so over a long session the hands of players who left reached the room's size limit and every raise was refused as full for the players still there. A raise that would leave the hands over the limit now drops the hands of players no longer in the room, which are shown nowhere. While there is space nothing is dropped, so a player who rejoins with the same id keeps their place in line.

  • Changedpatch

    Raised hands no longer put the person who has the word back in the line. A raise from the current speaker (a second phone, or a tap that was already in flight when the host called them) was accepted, so they showed as speaking and as next in line at once, and kept a hand up after the host finished. The room now refuses it as wrong-phase; a hand raised after done still joins the line.

  • Changedpatch

    Quiz scoring and reactions no longer break on forged or malformed state. scoreAnswer used a NaN or infinite speedShare or maxPoints and scored NaN, which poisoned the standings: it now uses the defaults. allowReaction accepted a reaction whose time was NaN or infinite without spending any budget, threw on a budget that was not an object or held a non-array entry, and counted null or string entries as times: it now refuses a time that is not finite and ignores entries that are not numbers. tallyReactions threw on a null reaction and returned a kind listed twice as two rows: it skips the null and returns one row per kind.

  • Changedpatch

    ReactionStream no longer replays the room's recent reactions on a phone or screen that joins late, refreshes or reconnects. Its state arrives after the first render, and it used to float all of it at once. useRoomReactions now returns ready; wire it to ReactionStream.ready.

  • Changedpatch

    The reaction budget decides a repeated reaction (same person, same time) from the stamps it still counts, so a duplicate and a first reaction are told apart by the same window rule as every other. No behaviour change for a room: a resent reaction is still one reaction and spends no budget.

  • Changedpatch

    Reactions no longer go silent after the host clears or restarts them. The room numbered each reaction from its count (r1, r2, …) and a clear started the count again at zero, but a screen floats each id once and remembers every id it has seen, so after a clear the new r1 to rN looked already seen and nothing floated until the count passed the old one. The count now carries on through a clear or restart, so an id is never reused. Totals and the rate limit still start over.

  • Changedpatch

    A person whose phone clock ran ahead is no longer rate-limited from reacting until the room's time catches up. Their stamps, later than the reaction being judged, counted as inside the window for good; they now count as out of it, so the next reaction is allowed and the budget forgets them.

  • Changedpatch

    A live-room reaction from a player whose id is an Object.prototype key (constructor, toString, __proto__) no longer throws. The rate limit looked the id up on a plain object and got an inherited function, so allowReaction raised a TypeError and the room could not count that player's reaction. The budget now reads own keys only, and a __proto__ player's rate limit survives a JSON save and restore.

  • Changedpatch

    A player whose id is longer than 64 characters no longer has their moves swallowed. The room does not bound a player's id, but every reader of a live activity drops anything over 64 characters, so a dot, reaction, raised hand or question from such a player was acknowledged and then never appeared on any screen. The activities now refuse it as bad-action, so the phone learns the move did not land.

@interlace/ui 2.0.02 entries

  • Addedminor

    The room's pulse while someone talks. ReactionBar gives a phone one round button per reaction kind (a neutral DEFAULT_REACTIONS set: love it, agree, funny, new to me, lost me; pass your own kinds), each popping on tap. ReactionStream lets every new reaction float up a shared screen with a slight drift and fade (1.6s, Web Animations, at most maxFloating at once, nothing on first load), and keeps a per-kind tally that screen readers read and that is the whole view under reduced motion. RaiseHand is a toggle that says the person's place in line and when it is their turn; HandQueue gives the host the line in order with call next, call on a named person, lower a hand and done. The rules are pure in games/reactions-model: allowReaction (a sliding per-person budget, 6 in 3 seconds by default), tallyReactions, and createHands / applyHandEvent / placeInLine (first raised, first called; lowering and raising again goes to the back).

  • Changedpatch

    Room activities hold up after a reconnect. buildCloud counts an entry with an id once however often it arrives, and counts a sender (by) once per word, so a resent batch of words changes nothing. The hand queue's docs say to send call with by, so a call delivered twice calls one person. New tests replay a busy room of 60 with every event doubled, restore a board from a saved snapshot (a late joiner or a refreshed host), flood the reaction stream after a refresh, and place a spectrum dot with the keyboard alone.

Import

13 named exports — pull the parts you need.

Public API
import { DEFAULT_REACTIONS, HandEvent, HandQueue, MIN_VIEWPORT, RaiseHand, ReactionBar, ReactionBudget, ReactionStream, allowReaction, applyHandEvent, createHands, placeInLine, tallyReactions } from '@/components/ui/games/reactions';

Anatomy

Extracted from the primitive's JSDoc header. The source is the only documentation that can't drift.

ReactionBar        (div role="group" — data-slot="reaction-bar": one Button per kind)
  ReactionStream     (div — data-slot="reaction-stream": aria-hidden floats + the tally)
  RaiseHand          (div — data-slot="raise-hand": a toggle Button and the place in line)
  HandQueue          (section — data-slot="hand-queue": who is speaking, the line, Call next)

API reference

Parsed from the type declarations in the source — the same file the install writes into your tree, so this table can't drift from the component you get.

ReactionBarProps

Also accepts every <div> attribute.

PropTypeDescription
kindsreadonly ReactionKind[]—
onReact(kind: string) => voidCalled on every tap, with the kind id.
disabledbooleanTaps are paused (for example while over budget).
labelstringThe group's name. @default 'React'

ReactionStreamProps

Also accepts every <div> attribute.

PropTypeDescription
kindsreadonly ReactionKind[]—
reactions*readonly { id: stringEvery allowed reaction so far (or a recent window); new ids float up once.
readybooleanFalse while the room has not told this screen its state yet (a late join, a refresh, a reconnect): what arrives then is remembered, never floated. `useRoomReactions` gives it. @default true
maxFloatingnumberThe most floating at once; the rest only count. @default 24
showTallybooleanShow the per-kind tally. Always on under reduced motion. @default true
localestring—

RaiseHandProps

Also accepts every <div> attribute.

PropTypeDescription
raised*boolean—
onChange(raised: boolean) => void—
placenumber | null1 for first in line (`placeInLine`).
speakingbooleanThis person has the word.
labelsRaiseHandLabels—

HandQueueProps

Also accepts every <section> attribute.

PropTypeDescription
hands*readonly RaisedHand[]—
speakingRaisedHand | null—
onCall(by?: string) => voidCall on the first in line, or on `by`.
onLower(by: string) => void—
onDone() => void—
labelsHandQueueLabels—

Accessibility

Every story for this component is rendered headlessly and checked with axe-core (wcag2aa, wcag22aa, best-practice, ACT) on every PR. That gate has no continue-on-error, so what ships has zero known violations.

What follows is what static analysis can see. Axe cannot press a key and never sees an overlay open, so the operable-without-a-mouse claim lives in Behavior instead, where the keyboard path is replayed step by step.

Focus + keyboard behaviour
Native element semantics — no interaction layer to get wrong.
Focus ring (WCAG 2.2 SC 2.4.13)
Not focusable — no focus indicator required.
Reduced motion
Animation is gated on prefers-reduced-motion.
ARIA in the source
  • role="group"
  • aria-label
  • aria-labelledby
  • aria-live
  • aria-pressed

Examples

3 more states from the same story file.

R-rule compliance

Every primitive in @interlace/ui models to the portable 26-rule floor enforced by the componentApi ESLint preset. The cells below pin exactly where each rule applies in this file.

RuleConceptWhere
R4Extends native el`div` / `section` props
R6data-slot per partreaction-bar / reaction-stream / raise-hand / hand-queue
R7cn + ...rest`cn(…, className)` + `{...props}`
R9ControlledRaiseHand `raised` / `onChange`
R14Declares min viewport`data-min-viewport` + exported const
R26A11ylabelled buttons; floats hidden, tally readable; place in line announced

Minimum viewport

This primitive declares MIN_VIEWPORT = 320 CSS px (DESIGN_PRINCIPLES #14). When mounted in a container narrower than this, the preflight contract draws a dev-mode outline so the regression is visible during local development.

Opt-in to the dev-mode warning
<body data-interlace-dev>...</body>

Add the data-interlace-dev attribute to the body in development builds only — preflight then outlines any primitive whose container is below its declared data-min-viewport.

Dependencies

Base UI primitive
Native / no Base UI dependency
Lucide icons
  • CircleHelp
  • Hand
  • Heart
  • Laugh
  • Lightbulb
  • Mic
  • ThumbsUp
NPM dependencies
  • lucide-react

Source

The full implementation — components/ui/games/reactions.tsx once installed.

471 lines · TypeScript
'use client';

import { Hand, Heart, Laugh, Lightbulb, CircleHelp, Mic, ThumbsUp } from 'lucide-react';

// @interlace/reactions v1.0.0 — Interlace design system.
// Docs, props and live preview: https://ds.interlace.tools/c/reactions
// What changed since: https://ds.interlace.tools/c/reactions#history
// Generated banner — keep it, the upgrade diff reads this version.

/**
 * @interlace/ui — ReactionBar, ReactionStream, RaiseHand and HandQueue
 *
 * The room's pulse while someone talks. Phones tap a reaction
 * (`ReactionBar`) and the shared screen lets it float up
 * (`ReactionStream`); someone who wants to speak raises a hand
 * (`RaiseHand`) and the host calls on people in the order they asked
 * (`HandQueue`).
 *
 * ## Who uses which part
 *

…451 more lines…

Registry JSON

The raw registry record — what the shadcn CLI fetches.