Question Board
Questions from the room, ranked by the room. People ask from their phone (`QuestionAsk`), vote up the questions they want answered (`QuestionBoard`), and a moderator approves, pins, answers or hides them (`QuestionQueue`) before anything typed reaches a…
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/question-board.jsonnpx shadcn@latest add @interlace/question-boardBehavior
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 destructive on background at 7.60:1 (harbor · light), against a floor of 4.5:1.
| Pair | interlacelight | interlacedark | harborlight | harbordark | Floor |
|---|---|---|---|---|---|
| destructive on backgroundtext-destructive on the page | 8.05:1 | 10.29:1 | 7.60:1 | 10.03:1 | 4.5:1SC 1.4.3 |
| muted-foreground on backgroundsecondary copy | 9.11:1 | 11.16:1 | 7.82:1 | 9.52:1 | 4.5:1SC 1.4.3 |
| destructive on cardtext-destructive in a card | 8.31:1 | 9.66:1 | 8.02:1 | 9.09: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 |
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/question-board.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.1.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.
Unreleased6 entries
- Changedpatch
A Q&A board no longer fills up with questions from phones that left. A phone that rejoins gets a new player id, so the questions of the old id stay in the room's slice, shown nowhere, and over a long session they pushed the board past the room's size limit until every live player's
askwas refused asfull. When a move would leave the board over the limit it now drops the dismissed questions first and then the questions of players no longer in the room. The newest id is kept so an id is never reused, and nothing is dropped while the board fits. - Changedpatch
A Q&A board no longer locks up when the votes on a question come from phones that left. A phone that rejoins gets a new player id, so the votes of the old id stay on a question that is still shown (nothing reads them:
readBoardhides them) and over a long session a popular question's vote list filled the room's size limit, after which every ask, vote and host move was refused asfull. When dropping dismissed questions and the questions of players who left still leaves the board over the limit, it now also drops the votes of players no longer in the room. Nothing is dropped while the board fits. - Changedpatch
A Q&A board at the room's size limit no longer locks everyone out. The room refuses any move that leaves a board over its limit, so once a crowd's long questions filled it, even the host's
dismisswas refused asfulland nothing could be freed. When a move would leave the board over the limit it now drops the dismissed questions, which are shown nowhere. New questions are numbered above every id the board holds, and the newest id is never dropped, so an id is never reused. Votes are unchanged. - Changedpatch
The Q&A board, the note board and the spectrum no longer crash or give wrong answers on forged room state. The board refuses a question whose text is not a string, keeps a forged time (NaN, Infinity) behind every real question, copes with a missing votes list or an entry that is not a question, changes only the first of two questions sharing an id, and counts only the four real statuses. The note board gives empty columns when notes or moves are not lists, and drops notes with no string id or a non-string text, so two id-less notes no longer merge into one. The spectrum summarises nothing for values that are not a list, falls back to ten bins and the 0 to 100 line for a bin count,
minormaxthat is not a finite number, caps the bin count at 1000 (a huge one crashed or exhausted memory), andbinOfreturns -1 for a value that is not a number.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. - Changedpatch
The open wall, the note board and the Q&A board no longer count the same text twice from one person. A double tap or a retry under a new id used to add a second post, note or question; the room now refuses it (a dismissed post or question does not block asking again, and another person or another note column may repeat it).
@interlace/ui 2.0.01 entry
- Addedminor
Questions from the room, ranked by the room.
QuestionAsklets a phone send a question of up tomaxLengthcharacters (default 200) with a live counter, refuses unsafe text throughtext-safety-modelwith a reason, and thanks the asker differently when the room is moderated.QuestionBoardlists live questions, the pinned one first and marked "Answering now", with a vote toggle (aria-pressed, the count in its name) that is off for the viewer's own question; questions glide to their new rank when votes change and the count rises into place.QuestionQueuegives a moderator review, live and done lists with approve, dismiss, pin, answered and restore, each sending one event. The state is pure and exported fromgames/question-board-model:createBoard,applyBoardEvent(review → live → answered or dismissed, one vote per person, never on your own, per-person limits) andrankQuestions(pinned, then votes, then oldest).
Import
20 named exports — pull the parts you need.
import { BoardEvent, BoardRejection, BoardResult, MIN_VIEWPORT, QuestionAsk, QuestionBoard, QuestionQueue, QuestionStatus, TextCheck, TextRefusal, applyBoardEvent, boardCounts, checkText, createBoard, foldText, isBlocked, rankQuestions, tidyText, visibleLength, wordsOf } from '@/components/ui/games/question-board';Anatomy
Extracted from the primitive's JSDoc header. The source is the only documentation that can't drift.
QuestionBoard (section — data-slot="question-board")
├─ ol (FlipGroup) (data-slot="question-board-list")
│ └─ li × n (data-slot="question-board-item", data-pinned, data-mine)
│ ├─ p (data-slot="question-board-text")
│ └─ Button | span (data-slot="question-board-vote", aria-pressed; or "question-board-count"
│ where nobody can vote: a shared screen, or the viewer's own)
└─ p aria-live (data-slot="question-board-status")
QuestionAsk (form — data-slot="question-ask": Textarea, counter, Send, message)
QuestionQueue (div — data-slot="question-queue": review and live lists with actions)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.
QuestionBoardProps
Also accepts every <section> attribute.
| Prop | Type | Description |
|---|---|---|
| questions* | readonly RankedQuestion[] | Live questions, ranked (`rankQuestions`). |
| onVote | (id: string, on: boolean) => void | Called when the viewer votes (`true`) or takes a vote back (`false`). Leave out for a shared screen: counts show without buttons. |
| size | 'default' | 'stage' | `stage` for a shared screen. @default 'default' |
| locale | string | — |
| labels | QuestionBoardLabels | — |
QuestionAskProps
Also accepts every <form> attribute.
| Prop | Type | Description |
|---|---|---|
| onAsk | (text: string) => void | Called with the checked text. |
| moderated | boolean | New questions wait for review (changes the thanks). @default true |
| maxLength | number | @default 200 |
| disabled | boolean | — |
| placeholder | string | — |
| labels | QuestionAskLabels | — |
QuestionQueueProps
Also accepts every <div> attribute.
| Prop | Type | Description |
|---|---|---|
| review* | readonly RankedQuestion[] | Questions waiting for review, oldest first. |
| live* | readonly RankedQuestion[] | Live questions, ranked. |
| done | readonly RankedQuestion[] | Answered and dismissed questions, to restore. |
| onEvent* | (event: BoardEvent) => void | Every action sends one event for `applyBoardEvent`. |
| locale | string | — |
| labels | QuestionQueueLabels | — |
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
- No animation to gate.
- ARIA in the source
aria-describedbyaria-invalidaria-labelaria-labelledbyaria-livearia-pressed
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` / `form` / `div` props |
| R6 | data-slot per part | question-board / -list / -item / -text / -vote / … |
| R7 | cn + ...rest | `cn(…, className)` + `{...props}` |
| R14 | Declares min viewport | `data-min-viewport` + exported const |
| R26 | A11y | ordered list; vote is a toggle button with its count in its name |
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
ArrowUpCheckEyeOffPinPinOffRotateCcw
- NPM dependencies
lucide-react
Source
The full implementation — components/ui/games/question-board.tsx once installed.
'use client';
import { ArrowUp, Check, EyeOff, Pin, PinOff, RotateCcw } from 'lucide-react';
// @interlace/question-board v1.1.0 — Interlace design system.
// Docs, props and live preview: https://ds.interlace.tools/c/question-board
// What changed since: https://ds.interlace.tools/c/question-board#history
// Generated banner — keep it, the upgrade diff reads this version.
/**
* @interlace/ui — QuestionBoard, QuestionAsk and QuestionQueue
*
* Questions from the room, ranked by the room. People ask from their phone
* (`QuestionAsk`), vote up the questions they want answered
* (`QuestionBoard`), and a moderator approves, pins, answers or hides them
* (`QuestionQueue`) before anything typed reaches a shared screen.
*
* ## Who uses which part
*
* | Phase | Who | Part |
…495 more lines…Registry JSON
The raw registry record — what the shadcn CLI fetches.