WaitingRoom is the host-side queue: every pending joiner appears as a row with their display name + optional join-reason note, with Admit / Reject buttons. A sticky "Admit all" CTA appears once the queue has 3+ pending requests.
Install
pnpm add @levelchat/react-components @levelchat/webRequirements
- React —
reactandreact-dom^18 || ^19(peer dependency). - LevelChat Web SDK —
@levelchat/web^0.2.4(peer dependency, wires hook-driven mode to the live Room). - Provider — wrap the tree in
<LevelChatProvider>from@levelchat/web-reactso hook-driven mode can subscribe to room events. Prop-driven demos work without it. - Styles — import the brand tokens + kit stylesheet exactly once at the app entry, before any kit component renders.
In Next.js (App Router), import the stylesheets at the top of your root layout:
TypeScript (TSX)
// app/layout.tsx
import '@levelchat/brand/tokens.css';
import '@levelchat/react-components/styles.css';In Vite (or any plain React app), import them at the top of your entry module:
TypeScript (TSX)
// src/main.tsx
import '@levelchat/brand/tokens.css';
import '@levelchat/react-components/styles.css';Basic usage
TypeScript (TSX)
import { WaitingRoom } from '@levelchat/react-components';
<WaitingRoom className="h-96 w-80" />Headless hook
import { useWaitingRoom } from '@levelchat/react-components';
function MyQueue() {
const { entries, admit, reject, admitAll, supported } = useWaitingRoom();
if (!supported) return null;
return (
<ul>
{entries.map((e) => (
<li key={e.id}>
{e.displayName}
<button onClick={() => admit(e.id)}>Admit</button>
<button onClick={() => reject(e.id)}>Reject</button>
</li>
))}
{entries.length >= 3 && <button onClick={admitAll}>Admit all</button>}
</ul>
);
}Props
| Prop | Type | Default | Notes |
|---|---|---|---|
onReject | (entry) => Promise<string | null> | string | null | — | Called on Reject — return a reason string (or a promise of one) to record why. The sticky "Admit all" CTA appears once 3+ requests are pending. |
hideWhenEmpty | boolean | true | Render nothing when the queue is empty. Pass false to keep the empty-state panel visible (useful when the host wants the panel to read as "quiet" rather than "not mounted"). |
className | string | — | Container override. |