videorc/ui

Platform Filter

The one platform filter for the Stream Manager's chat and Activity. An All chip and a chip per platform mark, and the same choice as radio items for a Filters menu. Nothing at all with one platform.

Chat from every platform.

Installation

$ pnpm dlx shadcn@latest add @videorc/platform-filter

Usage

import {
  PlatformFilter,
  PlatformFilterMenuItems,
} from "@/components/blocks/stream-manager/platform-filter";
<PlatformFilter
  label="Show chat from"
  onValueChange={setPlatform}
  platforms={["youtube", "twitch", "x"]}
  value={platform}
/>

Chat and Activity share it, so a platform filters the same way in both. A chip clicked again turns back to All. With one platform it renders nothing: there's nothing to filter by.

Below 640 px of Stream Manager the chips move into the pane's Filters menu: put PlatformFilterMenuItems inside a Dropdown Menu, with the same props. Chat Toolbar does both.

Theming

Token or attributeMeaning
ToggleGroupThe chips; the chosen one is the chrome plate
ChatPlatformIconEach platform's 20 px mark

Accessibility

The group is named by label ("Show chat from"). Each icon chip is named by its platform and says "Only YouTube" on hover. In the menu, the choice is a radio group under the same label, with "Every platform" first.

API reference

PlatformFilter

Prop

Type

PlatformFilterMenuItems

The same props, as a labelled radio group for a Filters menu.