@cloudflare/realtimekit-react-ui

中文文档
2.1.0发布于 2026/11/16TypeScriptESM + CJS构建来源已验证近 30 天下载 29.1万

Pre-built, ready-to-use React components, hooks and utilities for integrating with Cloudflare RealtimeKit

原始使用文档
文档目录3 节
  1. Usage
  2. Simple Usage
  3. Using <RtkUiProvider>

RealtimeKit React UI

RealtimeKit React UI provides pre-built, ready-to-use UI components for React for integrating with Cloudflare RealtimeKit.

If you're using a different framework or no framework (see HTML), we also offer dedicated packages:

Usage

First, install RealtimeKit UI along with RealtimeKit:

@cloudflare/realtimekit is the core package that offers APIs to handle meetings in the client side. You use it to access and perform actions in a meeting.

npm i @cloudflare/realtimekit-react-ui @cloudflare/realtimekit

Simple Usage

This is the simplest way to use RealtimeKit UI, where you don't have to manage the entire meeting UI on your own. Everything will be taken care of by the RtkMeeting component.

Use the useRealtimeKitClient() hook to access the meeting instance state, as well as the meeting instance initializer method.

Then pass the authToken of a participant that you receive from your API.

You call the RealtimeKit Add Participant API from your own backend API to get this authToken to use with RealtimeKit.

import { useRealtimeKitClient } from '@cloudflare/realtimekit/react';

function App() {
  const [meeting, initMeeting] = useRealtimeKitClient();

  useEffect(() => {
    initMeeting({
      authToken: '<auth-token>',
      roomName: '<room-name>',
      defaults: {
        audio: true,
        video: true,
      },
    });
  }, []);

  return <RtkMeeting meeting={meeting} />;
}

Using <RtkUiProvider>

If you wish to use individual UI components to build your desired UI, you can use the RtkUiProvider component to provide the meeting instance to all child components to make development easier:

import { useRealtimeKitClient } from '@cloudflare/realtimekit/react';
import {
  RtkUiProvider,
  RtkMeeting,
  RtkSimpleGrid,
} from '@cloudflare/realtimekit-react-ui';

function App() {
  const [meeting, initMeeting] = useRealtimeKitClient();

  useEffect(() => {
    initMeeting({
      authToken: '<auth-token>',
      roomName: '<room-name>',
      defaults: {
        audio: true,
        video: true,
      },
    });
  }, []);

  return (
    <RtkUiProvider meeting={meeting}>
      <RtkSimpleGrid />
    </RtkUiProvider>
  );
}

版本与发布记录

@cloudflare/realtimekit-react-ui 共发布 129 个版本,首次发布于 2025/04/05;过去 12 个月发布了 76 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.1.0latest2026/11/16今天
2.1.0-staging.6staging2026/11/16今天
2.1.0-staging.52026/11/132 天前
2.1.0-staging.42026/11/123 天前
2.1.0-staging.32026/11/124 天前
2.1.0-staging.22026/11/124 天前

关于 @cloudflare/realtimekit-react-ui 的常见问题

@cloudflare/realtimekit-react-ui 是什么?

Pre-built, ready-to-use React components, hooks and utilities for integrating with Cloudflare RealtimeKit

如何安装 @cloudflare/realtimekit-react-ui?

在项目目录运行 npm install @cloudflare/realtimekit-react-ui,或使用 pnpm add / yarn add / bun add。

@cloudflare/realtimekit-react-ui 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cloudflare/realtimekit-react-ui 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@cloudflare/realtimekit-react-ui 可以商用吗?

@cloudflare/realtimekit-react-ui 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@cloudflare/realtimekit-react-ui 的下载量有多少?

根据 npm 官方下载统计,@cloudflare/realtimekit-react-ui 在 2026/10/10 – 2026/11/08 这 30 天内被下载 290,537 次,日均约 9,685 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cloudflare/realtimekit-react-ui 还在维护吗?

最新版本 2.1.0 发布于 2026/11/16(今天);至今共发布 129 个版本,其中过去 12 个月发布了 76 个;首次发布于 2025/04/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。