CraftUI

Multiplayer Lobby

A lobby before a game: players and whether they're ready, a chat, and Ready, Leave and Start for the host.

Lobby

Night raid

Survival · Hard · Riverside

Players (3/8)

  • SKSkylark (you)HostNot ready
  • PEPebbleReady
  • MOMossReady

Chat

2 of 3 ready

Open on a page of its own

In the style of Ore UI's party screen.

Installation

npx shadcn@latest add @runqora/craft-multiplayer-lobby

Usage

import { MultiplayerLobby } from "@/components/craft/blocks/multiplayer-lobby";

<MultiplayerLobby
  currentPlayerId={me.id}
  messages={messages}
  name="Night raid"
  onLeave={leave}
  onReadyChange={setReady}
  onSendMessage={send}
  onStart={start}
  players={players}
/>;

Props

MultiplayerLobby

Prop

Type

Accessibility

  • New chat messages and the ready count are announced as they change.
  • Ready is a toggle button, announced as pressed or not.
  • Only the host has Start, and it's disabled until everyone is ready.

Customization

The block keeps only what's on screen, such as the search text. Your data comes in through props, and every action calls one of your handlers, so it works with any backend. Every screen fills its frame, so give it a height, such as h-dvh for a whole page.

Dependencies

  • craft-badge, craft-button, craft-input, craft-profile-panel, craft-screen and craft-scroll-area
  • shadcn's utils, and craft-theme

Source