LevelChatLevelChatDocs
NetworkIndicator

Components

NetworkIndicator

Good / fair / poor — bars or 8-px dot. Hook- or prop-driven.

NetworkIndicator renders a participant's connection quality bucket — one of good, fair, or poor — as either a small set of signal bars or as the 8-px status dot embedded in every VideoTile.

Install

pnpm add @levelchat/react-components

Basic usage

Hook-driven (subscribes to the live quality score for that participant):

import { NetworkIndicator } from '@levelchat/react-components';

<NetworkIndicator participantId="user_42" />

Or prop-driven for previews:

As 8-px dot

Inside VideoTile we render the status as a small dot in the corner instead of the full bars; pass asDot:

<NetworkIndicator participantId="user_42" asDot />

Headless hook

The styled component delegates to useConnectionQuality. Reach for the hook directly if you want to render a custom indicator:

import { useConnectionQuality } from '@levelchat/react-components';

function MyBars({ participantId }) {
  const { quality } = useConnectionQuality({ participantId });
  // quality: 'good' | 'fair' | 'poor' | undefined (unknown)
  return <span>{quality ?? 'unknown'}</span>;
}

Theming

The indicator colours come from three CSS tokens:

  • --lc-brand-primarygood bucket.
  • --lc-warning-solidfair bucket.
  • --lc-danger-solidpoor bucket.

The 8-px dot variant also paints a 2-px white halo so it stays readable when overlaid on a video tile.

Props

PropTypeDefaultNotes
participantIdstringHook-driven mode. Mutually exclusive with quality.
quality'good' | 'fair' | 'poor'hookForce the bucket. Wins over the hook.
sizenumber16Pixel size of the bars (ignored when asDot).
asDotbooleanfalseRender the 8-px corner dot variant instead of the bars.
classNamestringPass-through class for extra layout/positioning.