Live Room
A game night on one big screen and everyone's phones. The host opens a room and shows its JoinCode; players scan or type it and land in the lobby; the host starts, everyone sees the same countdown, plays the same rounds, and the night ends on a Podium. The…
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/live-room.jsonnpx shadcn@latest add @interlace/live-roomBehavior
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-foreground on primarycopy on a primary face | 8.80:1 | 11.79:1 | 8.86: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 |
| card-foreground on cardcopy in a card | 19.65:1 | 15.71:1 | 18.72:1 | 14.69: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/live-room.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.6.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.
Unreleased24 entries
- Changedpatch
A check-in whose room has filled up no longer refuses every pick, or the host's next round. It keeps a pick for everyone who ever chose a mood, in every round, and a phone that rejoins gets a new id, so over a long session the picks of players who left reached the room's size limit and each
pickandroundwas refused as full. A move that would leave the check-in over the limit now drops the picks of players no longer in the room, which are counted nowhere. While there is space nothing is dropped, so a player who rejoins with the same id keeps their mood.Components - Changedpatch
Rating, quadrant, pin drop, ranking, points split, dot vote, prediction and typed answer whose room has filled up no longer refuse every answer. They keep an answer for everyone who ever sent one, and a phone that rejoins gets a new id, so over a long session the answers of players who left reached the room's size limit and every
sendwas refused as full for the players still there. A move that would leave the activity over the limit now drops the answers 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 answer. - Changedpatch
A rating, quadrant, pin, ranking, points split, dot vote, prediction or typed-answer room at the size limit no longer locks the host out of closing or revealing it. Closing (
open: false) or revealing makes the slice a few characters longer, so on a room sitting at the limit the move was refused as full while answers from phones that left (shown nowhere) filled it. Such a move now lets go of the answers of players no longer in the room, and only when the result would pass the limit. - Changedpatch
Corners share one size check for a pick, a lock and a call, and a call names only a corner the room holds. Behaviour is unchanged: a corner id longer than the 24 characters a started room allows was never one it held, so the extra length check was redundant.
Components - Changedpatch
Debate corners whose room has filled up no longer refuse every pick. They keep a pick for everyone who ever chose a corner, and a phone that rejoins gets a new id, so over a long session the picks of players who left reached the room's size limit and every
pickwas refused as full for the players still there. A move that would leave the corners over the limit now drops the picks of players no longer in the room, which are counted nowhere. While there is space nothing is dropped, so a player who rejoins with the same id keeps their corner.Components - Changedpatch
An exit ticket whose room sits at the size limit no longer refuses every answer and the host's close. A ticket keeps each player's answers for as long as the room does, so after a long session the answers of phones that left (shown nowhere) filled it, and a new
send, or closing it (close), was refused as full. Such a move now lets go of the answers of players no longer in the room, and only when the result would pass the limit.Components - 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
A check-in or corners room the players who left have filled up can still be moved on by the host. Closing a check-in writes
"open":false, one character longer than"open":true, and calling a corner writes its id wherenullstood, so a room whose size sat at the room's limit had every close or call refused as full. A move that would not fit now drops the picks of players no longer in the room, which are shown nowhere. While there is space nothing is dropped. - Changedpatch
A note board the room has filled up can still be closed by the host. Closing writes
"open":false, one character longer than"open":true, so a board whose size sat at the room's limit (filled by notes of phones that left, which rejoin with new ids) had every close refused as full. A close that would not fit now drops the notes of players no longer in the room, and their moves, which are shown nowhere. While there is space nothing is dropped.Components - Changedpatch
Debate corners, check-in, exit ticket, rating, quadrant and the other one-answer activities refuse a move from a player whose id is over 64 characters or
__proto__. The room accepts any id, but every reader drops those, so the answer was accepted, shown for a moment and then lost on the next read. The move is now refused up front, as the Q&A board, reactions, hands and spectrum already do. - 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 live room's
revealnow scores a player whose id is__proto__. The round's points were read and written with plain property access, so that player's points were read as 0 and their entry inlastPointswas dropped. Points are now read from own keys andlastPointsis built withObject.fromEntries, so the id is kept as data. - Changedpatch
A word cloud, spectrum or debate corners round the room has filled up can still be closed by the host. Closing (or locking) writes
"open":false, one character longer than"open":true, so a room whose size sat at its limit (filled by the words, dots or picks of phones that left, which rejoin with new ids) had every close refused as full. A close that would not fit now drops what players no longer in the room hold, which is shown nowhere. While there is space nothing is dropped. - Changedpatch
The room join-code expiry check no longer carries a redundant
typeoftest.Number.isFiniteis already false for anything that is not a number, so a missing or non-numeric join time still counts as expired and behaviour is unchanged. - Changedpatch
An expired room code no longer admits a join whose time stamp is not a real number.
codeExpiredonly treated a missing stamp as expired, so a join withat: NaN,null(what JSON makes of NaN) or text compared false against the expiry and got in after the code had closed. Any stamp that is not a finite number now counts as expired while the room has an expiry; reconnects of known players are unchanged. - 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. - Changedpatch
A player whose id is also an Object.prototype name (
constructor,toString,valueOf) can now answer in a live room. The room checked "already answered" within, which also matches inherited keys, so that player's first answer was refused asalready-answeredand the host's progress count showed them as answered before they had. Both checks now look at the room's own answers only. - Changedpatch
Two redundant
typeoftests are gone from the live room's input checks: a move's timestamp and the numbers read back from a saved activity are now tested withNumber.isFinitealone, which is already false for anything that is not a number. A missing, string or NaN timestamp is still refused asbad-action; behaviour is unchanged. - Changedpatch
A reveal now adds points to a player whose id is
__proto__. The reveal still wrote scores withscores[id] = ...on a copied object, which hits the prototype setter for that id, so the player's total stayed where it was. Scores are now built withObject.fromEntries, the waylastPointsalready was. Follow-up to the__proto__fix in #412. - Changedpatch
A spectrum whose room has filled up no longer refuses every dot. It keeps a dot for everyone who ever placed one, and a phone that rejoins gets a new id, so over a long session the dots of players who left reached the room's size limit and every
placewas refused as full for the players still there. A move that would leave the spectrum over the limit now drops the dots 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 still finds their dot.Components - Changedpatch
The spectrum no longer loses the dot of a player whose id is
__proto__. The room accepts any id, the spectrum took that player's dot, and the next read (or the next player's dot) dropped it because the dots were assigned onto a plain object. They are now read as plain data, so every screen shows the dot.Components - Changedpatch
The word cloud, open wall and note board refuse a word, post or note from a player whose id is empty or over 64 characters. The room accepts any id, but their readers drop those, so the contribution was accepted, shown for a moment and then lost on the next read. It is now refused up front, as the one-answer activities, Q&A board, reactions, hands and spectrum already do.
- Changedpatch
An open wall no longer fills up with posts from phones that left. A phone that rejoins gets a new player id, so the posts of the old id stay in the room's slice, read by no screen, and over a long session they pushed the wall to its 300-post (or room size) limit until every live player's
postwas refused asfull. When the wall is full, apostnow lets go of the posts of players no longer in the room, as it already did for dismissed ones, before it refuses. The newest id is kept so an id is never reused, and nothing is dropped while the wall has room.Components - Changedpatch
A word cloud no longer fills up with words from phones that left. A phone that rejoins gets a new player id, so the words of the old id stay in the room's slice, shown nowhere, and they counted toward the 600-word cap (and the room's size limit) until every live player's word was refused as
full. When the cloud is at either limit it now lets go of the words of players no longer in the room before it refuses, and keeps everything while it fits.Components
@interlace/ui 2.2.01 entry
- Addedminor
The Q&A board, reactions, raised hands and spectrum now run on a live room with the room's guarantees.
useRoomBoard,useRoomReactions,useRoomHandanduseRoomSpectrumgive the props forQuestionBoard,QuestionAsk,QuestionQueue,ReactionBar,ReactionStream,RaiseHand,HandQueueandSpectrum(unchanged), andboardActivity,reactionsActivity,handsActivityandspectrumActivityare the rules the host runs. A move is applied once however often it arrives, a phone sends it again until the host's state shows it (a reaction is sent once: a late reaction is no reaction), several moves can be in flight at once, a refreshed host gets everything back, and a player who is removed disappears from what every screen reads. For that,RoomEventgainssubmit(a player's move in an activity:key,action, and a uniqueid),RoomStategainsacked(the last ids of each player's moves, kept throughserializeRoomandrestoreRoom), andRoomSettingsgainsactivities, a map of rules by key.useRoomstamps a move with the host's clock and tells a phone why a move was refused. Existing rooms are unchanged.
@interlace/ui 2.0.08 entries
- Addedminor
The live room is now a flow with one namespace:
LiveRoom.Lobby,LiveRoom.CountdownandLiveRoom.HostControls, so typingLiveRoom.lists the whole journey and every app writes it the same way.useRoom,useSecondsLeft, the label and prop types stay flat (nowLiveRoomLobbyProps,LiveRoomLobbyLabelsand so on). The header carries a flow map: each phase of the room, the part that shows it on the host screen and on a phone, and the event that moves it on. The live room has not been released yet, so the flatRoomLobby,RoomCountdownandRoomHostControlsnames go without a deprecation step. The rules for flows are indocs/philosophies/FLOW_PHILOSOPHY.md, and a new lock test holds them. - Addedminor
A live room kit for game nights on one big screen and everyone's phones.
QrCodedraws a join link as one SVG path from a dependency-free encoder (games/qr-model: byte mode, versions 1 to 40, levels L to H), and keeps dark-on-light on a dark page so every camera reads it.JoinCodeshows the address, a code no one misreads (makeJoinCode,normalizeJoinCode,formatJoinCode) spelled out for screen readers, the QR and a copy-link button.useRoomkeeps the host and every player on the same room: the host applies events with the pure rules ingames/room-model(no joining a locked room, one answer a round, only the host starts) and sends the state to all, over anyRoomTransport; an in-memory hub and a BroadcastChannel transport ship, and a realtime service is a small adapter in the app.RoomLobby(players pop in and are announced, the host can remove one),RoomHostControls(start, reveal, next, podium, lock, end, moving on by itself),RoomCountdown(3, 2, 1, Go to a host timestamp) andPodium(top three rising 3rd, 2nd, 1st with a burst for the winner, everyone else below) complete it. Every word goes throughlabels; all motion is transform or opacity and off under reduced motion. - Addedminor
Live rounds move.
AnswerPadplays the reveal: the right tile lands, the tiles nobody needs step back, a wrong pick gives one small nudge, and a right pick's points rise from its tile (transform and opacity only; nothing moves under reduced motion). NewStandings, the board between rounds: each player's points pop in, totals count up from where they were (CountUp), then the rows glide to their new places (FlipGroup) with places gained in words. An ordered list, ranks shared on ties. - Addedminor
Live rounds reach every phone.
games/room-modelgainsRoomState.promptandRoomState.solution: the host'squestionevent can carry what the round asks (prompt) and itsrevealthe answer (solution), so every screen, and a player who joins mid-round, shows the same round without a second channel. Both are null in the lobby, cleared by the next question and byrestart.AnswerPadis the player's side of a live round: big lettered tiles, the first pick final, "Answer in" while the host waits, then the right tile marked and the outcome in words. It never needs the right answer before the reveal, its state follows fromvalue,closedandcorrect(so a reconnect shows the same thing),display="keys"shows letters only for rooms that keep the words on the big screen, andchoiceKey(i)gives the big screen the same letters. Keys A to Z and 1 to 9 pick a tile; motion is transform only. - Addedminor
Animations started from script now follow the brand's
--ease-*and--duration-*tokens, like the CSS does. A newmotion-tokenlib item reads them from the element that moves.Components- @interlace/motion-token
- @interlace/calendar
- @interlace/time-slot-picker
- @interlace/multi-step-form
- @interlace/commitment
- @interlace/interest-signal
- @interlace/session-composer
- @interlace/guess-reveal
- @interlace/quiz-question
- @interlace/duel
- @interlace/order-game
- @interlace/podium
- @interlace/word-cloud
- @interlace/answer-pad
- @interlace/tally-bars
- @interlace/standings
- @interlace/closer-game
- @interlace/stagger-list
- @interlace/flip-group
- @interlace/reveal
- @interlace/celebrate
- @interlace/split-text
- @interlace/marker
- @interlace/rotating-text
- @interlace/draw-on
- Addedminor
Live rooms close the door on time and on guessers.
createRoomtakescodeExpiresAt: after it, the room refuses new players withexpiredwhile anyone already in can still reconnect, and the host moves it with anextend-codeevent.useRoomnow stamps each join with the host's clock, like answers, so a phone cannot beat the expiry by setting its clock back, and a join that arrives unstamped while the room has an expiry is refused.checkJoinAttempt/recordJoinAttempt(games/room-model) cap wrong codes per source (5) and per room (30) in a sliding window (10 minutes), so a six-character code cannot be guessed while a person who mistyped is never stopped.JoinCodetakesexpiresAtand says how many minutes the code still works; once it has expired the QR goes, the code is struck through and the change is announced.Components - Addedminor
Ways to run a live workshop, on the room's own state and transport.
useAgendaSynckeeps the existingAgendaandAgendaNowright across a presenter's windows: one window controls, any number show it over aRoomTransport<AgendaMessage>, a repeated tap is applied once, one made against an older screen is dropped and that screen is brought up to date, the controlling window's clock times everything (AgendaandAgendaNowgain an optionalnow), andcreateAgendaStorerestores the agenda after a refresh with the clock still counting.TeamBoard,TeamScoreboardandTeamBadgemake teams, balance them fairly (sizes within one; with scores the strongest players are dealt across teams), move a player by hand with a native select, and rank teams by average so a bigger team has no edge.BreakoutHostandBreakoutCardsplit the room into groups with a timer, send one message to every group (spoken once, whatever order states arrive in) and recall everyone.PairHostandPairCardpair everyone (a group of three when odd), deal each pair a card, and swap partners with the fewest repeats.RoomClockcounts a host timestamp in minutes and seconds and speaks only a minute left, ten seconds and time up.RoomStategainsshared, named extras the host sets with a newshareevent, so teams, groups and pairs inherit the room's guarantees: the newestseqwins, a late joiner and a reconnecting phone get them with the state, and a restored host restores them.serializeRoom,restoreRoomandcreateRoomStorekeep a room across the host's refresh (everyone comes backawayand rejoins by themselves,seqmoves ahead so phones take the saved room as the newest).RoomTransportand the in-memory and BroadcastChannel transports take a message type, so a presenter's windows reuse them. New tokens--team-1to--team-5(andbg-team-N,border-team-N) alias the chart palette and can be forked alone. - Addedminor
Live rooms hold up on real phones. Every state the host sends carries its clock, and
useRoomreturnsnow, this device's clock corrected to the host's (clockOffsetin room-model), so a phone whose clock is off still counts down to the host's deadline;TimerRingtakesnowtoo. A player's page now says it is away onpagehide, asks for the room again when it is seen, and rejoins by itself when shown away, unless the player left on purpose (presence: falseturns it off). Networks drop messages: a player's join or answer is sent again every 3s until the host's state shows it (5 tries), and the host no longer broadcasts a reply to a repeated or late answer.Components
Import
41 named exports — pull the parts you need.
import { ACK_KEEP, ActivityReducer, ActivityRefusal, JOIN_CODE_ALPHABET, JoinGuardVerdict, LiveRoom, MAX_SHARED_SIZE, MIN_VIEWPORT, RESTORE_SEQ_JUMP, RoomEvent, RoomHostEvent, RoomMessage, RoomPhase, RoomPlayerEvent, RoomRejection, answerProgress, applyRoomEvent, buildBoard, checkJoinAttempt, cleanName, clockOffset, codeExpired, connectedPlayers, createBroadcastRoomTransport, createJoinGuard, createMemoryRoomHub, createRoom, createRoomStore, formatJoinCode, makeJoinCode, normalizeJoinCode, pruneJoinGuard, rankEntries, readShared, recordJoinAttempt, rejectRoomEvent, restoreRoom, roomStandings, serializeRoom, useRoom, useSecondsLeft } from '@/components/ui/games/live-room';Anatomy
Extracted from the primitive's JSDoc header. The source is the only documentation that can't drift.
useRoom({ transport, selfId, host? }) → { room, isHost, send }
LiveRoom.Lobby (section — data-slot="room-lobby", data-count)
├─ div (data-slot="room-lobby-join": your JoinCode, when given)
├─ h2 (data-slot="room-lobby-count": "8 players")
├─ ul (data-slot="room-lobby-players")
│ └─ li × n (data-slot="room-lobby-player", data-self, data-away)
│ └─ Button? (data-slot="room-lobby-remove", host only)
├─ p (data-slot="room-lobby-empty", before anyone joins)
├─ div (data-slot="room-lobby-actions": host controls, or "Waiting for the host")
└─ span aria-live (data-slot="room-lobby-announce": "Dana joined")
LiveRoom.Countdown (div role="timer" — data-slot="room-countdown", data-state)
├─ span (data-slot="room-countdown-value": 3, 2, 1, then "Go")
└─ span aria-live (data-slot="room-countdown-announce")
LiveRoom.HostControls (div role="group" — data-slot="room-host-controls", data-phase)
├─ p aria-live (data-slot="room-host-status": "5 of 8 answered")
├─ Button (data-slot="room-host-primary": Start / Reveal / Next / Podium / Play again)
├─ Button (data-slot="room-host-lock": lock or unlock)
└─ Button (data-slot="room-host-end")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.
LiveRoomLobbyProps
Also accepts every <section> attribute.
| Prop | Type | Description |
|---|---|---|
| players* | readonly RoomPlayer[] | — |
| selfId | string | The viewer's id, to mark their chip. |
| join | React.ReactNode | Your JoinCode (or any way in), shown beside the players. |
| actions | React.ReactNode | Host controls. Leave out on a player's screen to show `labels.waiting`. |
| onRemove | (playerId: string) => void | Shows a remove button on each chip (host only). |
| hideAway | boolean | Hide players who dropped out. @default false |
| labels | LiveRoomLobbyLabels | — |
LiveRoomCountdownProps
Also accepts every <div> attribute.
| Prop | Type | Description |
|---|---|---|
| startsAt* | number | null | When it reaches 0, in ms (host clock). null: idle. |
| now | () => number | Your clock, corrected to the host's. @default Date.now |
| onDone | () => void | Called once at 0. |
| size | 'default' | 'stage' | @default 'default' |
| labels | LiveRoomCountdownLabels | — |
LiveRoomHostControlsProps
Also accepts every <div> attribute.
| Prop | Type | Description |
|---|---|---|
| room* | RoomState | — |
| send* | (event: RoomHostEvent) => void | `send` from the host's `useRoom`. |
| minPlayers | number | Players needed to start. @default 1 |
| countdownSeconds | number | Seconds of countdown before each round. @default 3 |
| roundSeconds | number | null | Seconds per round, or null for no clock. @default 20 |
| score | (room: RoomState) => Record<string, number> | Points per player id for the round being revealed. @default () => ({}) |
| autoAdvance | boolean | Move on by itself: open the round when the countdown ends, reveal when the clock runs out or everyone has answered. @default true |
| now | () => number | @default Date.now |
| labels | LiveRoomHostControlsLabels | — |
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"role="timer"aria-labelaria-labelledbyaria-live
Examples
4 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 | `section` / `div` props |
| R6 | data-slot per part | room-lobby-*, room-countdown-*, room-host-* |
| R7 | cn + ...rest | `cn(…, className)` + `{...props}` |
| R8 | Enums, not booleans | `size` |
| R14 | Declares min viewport | `data-min-viewport` + exported const |
| R25 | Client component | the room runs in the browser |
| R26 | A11y | list of players; sparse live announcements; timer role |
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
LockLockOpenX
- NPM dependencies
lucide-react
Source
The full implementation — components/ui/games/live-room.tsx once installed.
'use client';
import * as React from 'react';
// @interlace/live-room v1.6.0 — Interlace design system.
// Docs, props and live preview: https://ds.interlace.tools/c/live-room
// What changed since: https://ds.interlace.tools/c/live-room#history
// Generated banner — keep it, the upgrade diff reads this version.
/**
* @interlace/ui — LiveRoom: useRoom and the LiveRoom flow (Lobby, Countdown, HostControls)
*
* A game night on one big screen and everyone's phones. The host opens a
* room and shows its JoinCode; players scan or type it and land in the
* lobby; the host starts, everyone sees the same countdown, plays the same
* rounds, and the night ends on a Podium. The rules of the room live in
* `room-model.ts` (pure), and the network is whatever `RoomTransport` the
* app passes, so no realtime vendor is built in.
*
* ## Flow
…854 more lines…Registry JSON
The raw registry record — what the shadcn CLI fetches.