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`).
Preview
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.
npx shadcn@latest add https://ds.interlace.tools/r/reactions.jsonnpx shadcn@latest add @interlace/reactionsBehavior
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.
Measured contrast
packages/ui/__tests__/theme-contract-lock.test.ts ↗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.
| Pair | interlacelight | interlacedark | harborlight | harbordark | Floor |
|---|---|---|---|---|---|
| muted-foreground on backgroundsecondary copy | 9.11:1 | 11.16:1 | 7.82:1 | 9.52:1 | 4.5:1SC 1.4.3 |
| muted-foreground on cardsecondary copy in a card | 9.41:1 | 10.48:1 | 8.25:1 | 8.64:1 | 4.5:1SC 1.4.3 |
| primary on backgroundtext-primary on the page | 8.52:1 | 11.63:1 | 8.39:1 | 10.03:1 | 4.5:1SC 1.4.3 |
| primary on cardtext-primary in a card | 8.80:1 | 10.92:1 | 8.86:1 | 9.10:1 | 4.5:1SC 1.4.3 |
| foreground on backgroundbody copy | 19.02:1 | 16.73:1 | 17.74:1 | 16.19:1 | 4.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.
Text equivalent
packages/ui/src/games/reactions.tsx ↗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.
Ships sr-only copy for what the visual carries by position, colour or icon alone — a label, not a full data equivalent.
Runtime contract
packages/ui/vitest.config.ts ↗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 = 320Declared, not assumed. Below 320 CSS px the preflight contract draws a dev-mode outline — how to switch it on.
- Coverage gate
not in the gateThe 100% gate currently covers
src/charts/**/*.{ts,tsx}andpure 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 pickerandsrc/patterns/time-slot-model.tsandsrc/patterns/share-image-model.tsandsrc/patterns/{interest-model,commitment-model,session-plan-model,recap-model}.tsandsrc/primitives/{file-model.ts,file-drop.tsx}andsrc/patterns/avatar-upload.tsxands 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
raisewas 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.Components - 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 afterdonestill joins the line. - Changedpatch
Quiz scoring and reactions no longer break on forged or malformed state.
scoreAnswerused aNaNor infinitespeedShareormaxPointsand scoredNaN, which poisoned the standings: it now uses the defaults.allowReactionaccepted a reaction whose time wasNaNor infinite without spending any budget, threw on a budget that was not an object or held a non-array entry, and countednullor string entries as times: it now refuses a time that is not finite and ignores entries that are not numbers.tallyReactionsthrew on anullreaction and returned a kind listed twice as two rows: it skips the null and returns one row per kind.Components - Changedpatch
ReactionStreamno 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.useRoomReactionsnow returnsready; wire it toReactionStream.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 newr1torNlooked 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, soallowReactionraised 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.Components - 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.
ReactionBargives a phone one round button per reaction kind (a neutralDEFAULT_REACTIONSset: love it, agree, funny, new to me, lost me; pass your ownkinds), each popping on tap.ReactionStreamlets every new reaction float up a shared screen with a slight drift and fade (1.6s, Web Animations, at mostmaxFloatingat once, nothing on first load), and keeps a per-kind tally that screen readers read and that is the whole view under reduced motion.RaiseHandis a toggle that says the person's place in line and when it is their turn;HandQueuegives the host the line in order with call next, call on a named person, lower a hand and done. The rules are pure ingames/reactions-model:allowReaction(a sliding per-person budget, 6 in 3 seconds by default),tallyReactions, andcreateHands/applyHandEvent/placeInLine(first raised, first called; lowering and raising again goes to the back). - Changedpatch
Room activities hold up after a reconnect.
buildCloudcounts an entry with anidonce 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 sendcallwithby, 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.Components
Import
13 named exports — pull the parts you need.
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.
| Prop | Type | Description |
|---|---|---|
| kinds | readonly ReactionKind[] | — |
| onReact | (kind: string) => void | Called on every tap, with the kind id. |
| disabled | boolean | Taps are paused (for example while over budget). |
| label | string | The group's name. @default 'React' |
ReactionStreamProps
Also accepts every <div> attribute.
| Prop | Type | Description |
|---|---|---|
| kinds | readonly ReactionKind[] | — |
| reactions* | readonly { id: string | Every allowed reaction so far (or a recent window); new ids float up once. |
| ready | boolean | False 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 |
| maxFloating | number | The most floating at once; the rest only count. @default 24 |
| showTally | boolean | Show the per-kind tally. Always on under reduced motion. @default true |
| locale | string | — |
RaiseHandProps
Also accepts every <div> attribute.
| Prop | Type | Description |
|---|---|---|
| raised* | boolean | — |
| onChange | (raised: boolean) => void | — |
| place | number | null | 1 for first in line (`placeInLine`). |
| speaking | boolean | This person has the word. |
| labels | RaiseHandLabels | — |
HandQueueProps
Also accepts every <section> attribute.
| Prop | Type | Description |
|---|---|---|
| hands* | readonly RaisedHand[] | — |
| speaking | RaisedHand | null | — |
| onCall | (by?: string) => void | Call on the first in line, or on `by`. |
| onLower | (by: string) => void | — |
| onDone | () => void | — |
| labels | HandQueueLabels | — |
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-labelaria-labelledbyaria-livearia-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.
| Rule | Concept | Where |
|---|---|---|
| R4 | Extends native el | `div` / `section` props |
| R6 | data-slot per part | reaction-bar / reaction-stream / raise-hand / hand-queue |
| R7 | cn + ...rest | `cn(…, className)` + `{...props}` |
| R9 | Controlled | RaiseHand `raised` / `onChange` |
| R14 | Declares min viewport | `data-min-viewport` + exported const |
| R26 | A11y | labelled 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.
<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
CircleHelpHandHeartLaughLightbulbMicThumbsUp
- NPM dependencies
lucide-react
Source
The full implementation — components/ui/games/reactions.tsx once installed.
'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.