# Video SDK UI Toolkit 2.0

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

![UI Toolkit annotated screenshot](/img/uitk2-screenshot-annotated.png)

The Video SDK UI Toolkit Modular for React is a set of React components for building video sessions on the Zoom Video SDK. Use **App mode** for the complete session UI, or **Component mode** to build your own layout from modules, controls, panels, and hooks. Both support dark and light themes and mobile layouts.

The previous screenshot shows App mode on desktop. Its labeled areas are Component mode building blocks you can use on their own: `TopBar`, `ParticipantView`, and `Toolbar`, all inside `ZoomUIToolkitProvider`. App mode also handles speaker view, screen sharing, responsive controls, and notifications.

Start with **Quickstart** to join your first session. Then choose App mode or Component mode. The [full sample](https://github.com/zoom/videosdk-ui-toolkit-modular-sample) lets you explore both modes.

## Quickstart: Join your first session

This path builds a minimal version of the official React sample: SDK initialization, token fetching, the provider, styles, and the prebuilt UI. Have **Node.js 22.13 or newer** and your Video SDK credentials ready. Once the auth server and a React 19 app are available, the integration is a copy-and-run step.

### 1. Start the auth server

Use Zoom’s [Video SDK auth endpoint sample](https://github.com/zoom/videosdk-auth-endpoint-sample) to issue the tokens:

```bash
git clone https://github.com/zoom/videosdk-auth-endpoint-sample.git
cd videosdk-auth-endpoint-sample
cp .env.example .env
npm install
```

Edit `.env` and set `ZOOM_VIDEO_SDK_KEY` and `ZOOM_VIDEO_SDK_SECRET` to your Video SDK credentials. Keep these credentials on the auth server.

```bash
npm run start
```

Leave this terminal running. The auth server listens on `http://localhost:4000`.

The auth server accepts `POST /` with `sessionName` and `role` and returns `{ signature }`. The app requests a fresh signature each time you join.

### 2. Create or open a React 19 app

In a second terminal, create a Vite React TypeScript app, or use your existing React 19 app. For a new app:

```bash
npm create vite@latest video-session -- --template react-ts
cd video-session
npm install
npm install @zoom/videosdk-ui-toolkit@2.6.0-2 @zoom/videosdk react@19 react-dom@19
```

### 3. Add the app files

Copy these five files into `src/`; `main.tsx` and `App.tsx` replace the starter files. `main.tsx`, `config.ts`, `auth.ts`, and `App.tsx` follow the official React sample; `Viewport.tsx` replaces the sample's join form with a single **Join session** button. Set `topic`, `userName`, and `role` (`1` for host, `0` for participant) in `config.ts`. The token request asks for WebRTC video, as the sample does.

```tsx
// src/main.tsx
import "@zoom/videosdk-ui-toolkit/style.css";
import { createRoot } from "react-dom/client";
import { App } from "./App";

createRoot(document.getElementById("root")!).render(<App />);
```

```ts
// src/config.ts
export const config = {
    authEndpoint: "http://localhost:4000",
    topic: "weekly-design-review",
    userName: "React user",
    sessionPassword: "",
    role: 1 as 0 | 1,
    webEndpoint: "zoom.us",
};
```

```ts
// src/auth.ts
export interface AuthTokenRequest {
    endpoint: string;
    sessionName: string;
    role: 0 | 1;
}

export async function requestSessionToken(
    request: AuthTokenRequest,
    signal?: AbortSignal,
): Promise<string> {
    const response = await fetch(request.endpoint.trim(), {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
            sessionName: request.sessionName,
            role: request.role,
            videoWebRtcMode: 1,
        }),
        signal,
    });

    if (!response.ok) {
        throw new Error(`Auth endpoint returned HTTP ${response.status}.`);
    }

    const body: unknown = await response.json();
    if (
        !body ||
        typeof body !== "object" ||
        !("signature" in body) ||
        typeof body.signature !== "string" ||
        !body.signature.trim()
    ) {
        throw new Error("Auth endpoint did not return a signature.");
    }

    return body.signature;
}
```

```tsx
// src/App.tsx
import { useCallback, useEffect, useRef, useState } from "react";
import ZoomVideo from "@zoom/videosdk";
import {
    ConnectionState,
    useZoomUIToolkit,
    ZoomUIToolkitProvider,
} from "@zoom/videosdk-ui-toolkit";
import type { ZoomUIToolkitProviderProps } from "@zoom/videosdk-ui-toolkit";
import { Viewport } from "./Viewport";
import { config } from "./config";

type ZoomClient = NonNullable<ZoomUIToolkitProviderProps["clientInstance"]>;
type ZoomLocalAudioTrack = NonNullable<
    ZoomUIToolkitProviderProps["localAudioTrack"]
>;

export function App() {
    const [client, setClient] = useState<ZoomClient | null>(null);
    const [localAudioTrack, setLocalAudioTrack] =
        useState<ZoomLocalAudioTrack | null>(null);
    const { sessionState } = useZoomUIToolkit();
    const { connectionState } = sessionState;
    const hasConnectedRef = useRef(false);

    const initClient = useCallback(async () => {
        try {
            const zoomClient =
                ZoomVideo.createClient() as unknown as ZoomClient;
            await zoomClient.init("en-US", "Global", {
                webEndpoint: config.webEndpoint,
                enforceMultipleVideos: true,
            });
            const audioTrack =
                ZoomVideo.createLocalAudioTrack() as unknown as ZoomLocalAudioTrack;
            setLocalAudioTrack(audioTrack);
            setClient(zoomClient);
        } catch (error) {
            console.error(error);
        }
    }, []);

    useEffect(() => {
        void initClient();
    }, [initClient]);

    useEffect(() => {
        if (connectionState === ConnectionState.Connected) {
            hasConnectedRef.current = true;
        } else if (
            connectionState === ConnectionState.Closed &&
            hasConnectedRef.current
        ) {
            hasConnectedRef.current = false;
            void (async () => {
                setClient(null);
                setLocalAudioTrack(null);
                await ZoomVideo.destroyClient();
                await initClient();
            })();
        }
    }, [connectionState, initClient]);

    return (
        <ZoomUIToolkitProvider
            clientInstance={client}
            localAudioTrack={localAudioTrack ?? undefined}
        >
            <Viewport />
        </ZoomUIToolkitProvider>
    );
}
```

```tsx
// src/Viewport.tsx
import { useState } from "react";
import {
    ConnectionState,
    useZoomUIToolkit,
    ZoomUIToolkitApp,
} from "@zoom/videosdk-ui-toolkit";
import { requestSessionToken } from "./auth";
import { config } from "./config";

export function Viewport() {
    const { client, sessionState } = useZoomUIToolkit();
    const [isJoining, setIsJoining] = useState(false);
    const [joinError, setJoinError] = useState("");
    const isConnected =
        sessionState.connectionState === ConnectionState.Connected &&
        !isJoining;

    async function joinSession() {
        if (!client || isJoining) return;
        setIsJoining(true);
        setJoinError("");
        try {
            const token = await requestSessionToken({
                endpoint: config.authEndpoint,
                sessionName: config.topic,
                role: config.role,
            });
            await client.join(
                config.topic,
                token,
                config.userName,
                config.sessionPassword,
            );
        } catch (error) {
            setJoinError(
                error instanceof Error
                    ? error.message
                    : error && typeof error === "object" && "reason" in error
                      ? String(error.reason)
                      : "Could not join the session. Please try again.",
            );
        } finally {
            setIsJoining(false);
        }
    }

    if (isConnected) return <ZoomUIToolkitApp height="100dvh" />;
    return <main>{joinError && <p role="alert">{joinError}</p>}</main>;
}
```

### 4. Run and join

```bash
npm run dev
```

Open the localhost URL printed by Vite and select **Join session**. The app fetches a token from `http://localhost:4000` and joins the session. Select Audio to join audio and Video to start your camera. To try a second participant, use the same `topic` in another browser with a different `userName` and `role` set to `0`.

If the SDK fails to join, check that the auth server is running, its credentials are configured, and the token's session name matches `topic`. The example displays auth and join failures on screen. For production, authorize the caller and allowed session and role on the server before issuing a token.

### Try the full React sample

The new [React sample](https://github.com/zoom/videosdk-ui-toolkit-modular-sample) contains App and Component modes, session entry fields, token fetching, and a component editor. Its default `authEndpoint` is `http://localhost:4000`. Clone, install, and run it with the following commands, then open `http://localhost:3000`.

```bash
git clone https://github.com/zoom/videosdk-ui-toolkit-modular-sample.git
cd videosdk-ui-toolkit-modular-sample
npm install
npm run dev
```

-   **App:** Join to try the complete session UI, participant views, toolbar, chat, and settings.
-   **Components:** Choose components before joining; then adjust props, size, colors, and themes, try desktop/mobile presets, and copy component code.

Leave the session to return to the join screen and try the other mode.

## App mode vs Component mode

| Choose         | When to use it                                                                        | What you render                                              |
| -------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| App mode       | You want a complete session screen with built-in layout and responsive behavior.      | `ZoomUIToolkitApp` inside `ZoomUIToolkitProvider`            |
| Component mode | You need custom placement, a minimal set of controls, or your own session experience. | Modules, buttons, panels, and hooks inside the same provider |

Both modes use the same client, provider, session state, themes, and Video SDK session. You can start with App mode and replace its screen with a custom layout without changing the authentication flow.

## App mode guide

`ZoomUIToolkitApp` renders the complete session screen: a top bar, participant videos, received screen shares, a preview of your own share on desktop, and a toolbar. It does not join by itself, so pair it with `JoinButton` or your own `client.join()`. It shows "Joining the session..." while `JoinButton` is joining or while the connection is being restored, and renders an empty container before joining, after leaving, or if joining fails.

Start with the Quickstart files to set up the client, token request, and provider. Use the props to configure the prebuilt screen in your own app.

### What's included

On desktop, the top bar has the session info button, the recording status, and a Gallery or Speaker view menu. The toolbar has Audio, Video, Participants, Chat, Share, Record, Settings, More, and Leave (End for the host).

| Area          | What it does                                                                                                                                      |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| Gallery view  | Paginated video grid with the active speaker outlined                                                                                             |
| Speaker view  | One large tile for the active video participant, with the others in a row above                                                                   |
| Screen share  | Received shares with a "You are viewing `{name}'s` screen" banner and View Options; your own share shows as a preview with a floating sharing bar |
| Chat          | Messages to everyone or one person, unread badge, delete your own messages; hosts and co-hosts can delete any message and set chat privileges     |
| Participants  | Search, per-participant actions based on your role, and Mute All for hosts and co-hosts                                                           |
| Settings      | Audio, Video, Share screen, and Statistics tabs                                                                                                   |
| Session info  | Topic, session ID, your name, and user ID                                                                                                         |
| Leave / End   | Participants and co-hosts leave at once; the host chooses "End meeting for all" or "Leave meeting"                                                |
| Notifications | Blocked camera or microphone, media issues, unstable network, recording consent, and the reclaim-host banner for the original host                |

### Configure size and features

Configure App mode with props on `ZoomUIToolkitApp` and on the provider. For anything beyond this, switch to **Component mode**.

| To change                                             | Use props                                                                                                                                                      |
| ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Size and container styling                            | `width`, `height` (both default `'100%'`), `className`, `style`                                                                                                |
| Which toolbar buttons appear                          | `toolbarProps.visibleButtons`                                                                                                                                  |
| Extra items in the audio or video menu                | `toolbarProps.audioButtonProps.menuGroups`, `toolbarProps.videoButtonProps.menuGroups`                                                                         |
| Audio or video button content                         | `toolbarProps.audioButtonProps.renderContent`, `toolbarProps.videoButtonProps.renderContent`                                                                   |
| Chat bubble colors, sent-message callback             | `toolbarProps.chatButtonProps.messageBubbleStyles`, `onMessageSent`                                                                                            |
| Record menu placement                                 | `toolbarProps.recordButtonProps.dropdownOptions`                                                                                                               |
| Theme                                                 | Provider `theme` (see **Dark and light themes**)                                                                                                               |
| Noise suppression and virtual backgrounds             | Provider `sessionOptions.audio` and `sessionOptions.video`                                                                                                     |
| Turn off built-in dialogs                             | `sessionOptions.recording.disableRecordingConsentDialog`, `sessionOptions.session.disableReclaimHostBanner`, `sessionOptions.audio.disableUnmuteConsentDialog` |
| Stacking order of the app, panels, menus, and dialogs | Provider `baseZIndex` (default `1000`)                                                                                                                         |
| "Test microphone" and "Test speaker" in Settings      | Provider `localAudioTrack`                                                                                                                                     |

### Toolbar buttons

`visibleButtons` sets which toolbar buttons appear. The keys are `audio`, `video`, `participant`, `chat`, `share`, `record`, `settings`, and `leave`. The SDK displays only `true` entries. The rest are hidden, not moved into More. More is always visible and holds visible buttons that don't fit. For a toolbar with only Audio and Leave, render `AudioButton` and `LeaveButton` in Component mode.

This example hides Share and Record. Render `MeetingLayout` in the Quickstart's `Viewport` in place of `ZoomUIToolkitApp`.

```tsx
// src/MeetingLayout.tsx
import {
    ZoomUIToolkitApp,
    type ToolbarButtonVisibility,
} from "@zoom/videosdk-ui-toolkit";
const visibleButtons: ToolbarButtonVisibility = {
    audio: true,
    video: true,
    participant: true,
    chat: true,
    settings: true,
    leave: true,
};
export function MeetingLayout() {
    return (
        <ZoomUIToolkitApp height="100dvh" toolbarProps={{ visibleButtons }} />
    );
}
```

### Responsive toolbar

When the window gets narrow, Settings, Record, Share, Chat, and Participants move into More, in that order, and come back as space frees up. Audio, Video, and Leave stay on the toolbar.

### Chat bubble colors

Use `toolbarProps.chatButtonProps.messageBubbleStyles` to style chat bubbles: `incoming` for messages from other participants and `outgoing` for your own. Render `MeetingLayout` in the Quickstart's `Viewport` in place of `ZoomUIToolkitApp`.

```tsx
// src/MeetingLayout.tsx
import {
    ZoomUIToolkitApp,
    type ChatMessageBubbleStyles,
} from "@zoom/videosdk-ui-toolkit";
const messageBubbleStyles: ChatMessageBubbleStyles = {
    incoming: {
        backgroundColor: "#EEF2FF",
        color: "#1E1B4B",
        borderRadius: 16,
    },
    outgoing: {
        backgroundColor: "#4F46E5",
        color: "#FFFFFF",
        borderRadius: 16,
    },
};
export function MeetingLayout() {
    return (
        <ZoomUIToolkitApp
            height="100dvh"
            toolbarProps={{ chatButtonProps: { messageBubbleStyles } }}
        />
    );
}
```

![UI Toolkit chat colors](/img/uitk2-doc-chat-colors.png)

### Session options

The official sample's `sessionOptions` are noise suppression on and two background images. Define it once outside your component, or memoize it, and pass it to the provider in the Quickstart's `App.tsx` as `sessionOptions={sessionOptions}`. To preselect a background, set `video.virtualBackground.defaultVirtualBackgroundImageId` to `''` for none, `'blur'`, or an image `id`. The provider applies it again when the connection state changes and whenever it receives a new `sessionOptions` object.

```tsx
import type { SessionOptions } from "@zoom/videosdk-ui-toolkit";

const sessionOptions: SessionOptions = {
    audio: { noiseSuppression: true },
    video: {
        virtualBackground: {
            virtualBackgroundImageList: [
                {
                    id: "Earth",
                    name: "Earth",
                    url: "https://source.zoom.us/uitoolkit/image/earth.jpg",
                },
                {
                    id: "San Francisco",
                    name: "San Francisco",
                    url: "https://source.zoom.us/uitoolkit/image/SanFrancisco.jpg",
                },
            ],
        },
    },
};
```

### Dark and light themes

Set the theme on the provider. The only values are `'dark'` (default) and `'light'`. Every built-in component inside the provider follows it, in both App mode and Component mode.

```tsx
<ZoomUIToolkitProvider clientInstance={client} theme="light">
    <Viewport />
</ZoomUIToolkitProvider>
```

To give part of a custom layout a different theme, wrap it in `ThemeProvider`. Read the current theme with `useTheme()` to style your own elements. Notifications ignore `ThemeProvider` and always use the provider's theme.

```tsx
import { ThemeProvider, Toolbar, useTheme } from "@zoom/videosdk-ui-toolkit";
export function LightToolbar() {
    return (
        <ThemeProvider theme="light">
            <Toolbar />
        </ThemeProvider>
    );
}
export function MyPanel() {
    const theme = useTheme();
    return <section data-theme={theme} className="my-panel" />;
}
```

### Desktop and mobile behavior

`ZoomUIToolkitApp`, `Toolbar`, `TopBar`, and `MoreButton` detect phones and tablets automatically. There is nothing to configure in App mode.

|                                    | Desktop                                                 | Phones and tablets                                                                                        |
| ---------------------------------- | ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| Participant videos                 | Gallery or Speaker view, paginated                      | Swipeable pages of up to four participants with page dots; a received share appears as the first page     |
| Toolbar                            | All controls; extra controls overflow into More         | Audio, Video, Participants, Chat, and Settings by default; setting `visibleButtons` replaces this default |
| Leave                              | On the toolbar                                          | In the top bar                                                                                            |
| Chat, Participants, Settings, More | Panels you can drag, and popovers                       | Bottom sheets                                                                                             |
| Screen share                       | Share your screen; a preview of your own share is shown | Viewing only; the Share button is disabled                                                                |
| Height                             | `height` prop                                           | Fills the viewport height; `height` is ignored                                                            |

## Component mode guide

Use Component mode when you need your own layout. Everything is rendered inside the same `ZoomUIToolkitProvider`, so all components share one session state.

Prefer the session modules for most layouts. `ParticipantView` and `MobileParticipantView` handle video containers and pagination for you; `ShareViewerView` handles received screen shares. Use the tile components only when your layout needs direct control over individual videos or shares.

### Build a normal video layout

Start with a video session: `TopBar` at the top, `ParticipantView` or a received `ShareViewerView` in the center, and `Toolbar` at the bottom.

```tsx
// src/MeetingLayout.tsx
import { ParticipantView, ShareViewerView, Toolbar, TopBar, useZoomUIToolkit } from '@zoom/videosdk-ui-toolkit';

export function MeetingLayout() {
  const { shareState } = useZoomUIToolkit();
  return (

      <TopBar />
      <div style={{ position: 'relative', minHeight: 0 }}>
        <ParticipantView pageSize={9} hidden={shareState.isReceivingShare} />
        <ShareViewerView hidden={!shareState.isReceivingShare} />

      <Toolbar />
    </div>
  );
}
```

Render `MeetingLayout` in the Quickstart's `Viewport` in place of `ZoomUIToolkitApp`. `Toolbar` and `TopBar` switch to their mobile layout on their own; for the video area on phones, use `MobileParticipantView` in place of `ParticipantView`.

### Audio-only call layout

This example builds an audio-only, one-to-one call screen with `AudioButton`, `ChatButton`, and `LeaveButton`, using their built-in icons. The participant name and connection status come from `useZoomUIToolkit()`. Pass the contact’s profile photo as `avatarUrl`; without it, the screen shows their initial. `ThemeProvider` gives the controls and the chat panel the light theme to match the card, and the following `MeetingLayout.css` sets the layout and the control size through `className`.

```tsx
// src/MeetingLayout.tsx
import {
    AudioButton,
    ChatButton,
    ConnectionState,
    LeaveButton,
    ThemeProvider,
    useZoomUIToolkit,
} from "@zoom/videosdk-ui-toolkit";
import "./MeetingLayout.css";

export function MeetingLayout({ avatarUrl }: { avatarUrl?: string }) {
    const { sessionState, participantState, audioState } = useZoomUIToolkit();
    const contact = participantState.participants.find(
        (person) => person.userId !== participantState.currentUser?.userId,
    );
    const connected =
        sessionState.connectionState === ConnectionState.Connected;
    const audioLabel = !audioState.isJoined
        ? "Join audio"
        : audioState.isMuted
          ? "Unmute"
          : "Mute";

    return (
        <ThemeProvider theme="light">
            <section aria-label="Audio call" className="audio-call">
                <header>
                    <small className="audio-call-label">AUDIO CALL</small>
                    <h2 className="audio-call-topic">
                        {sessionState.sessionInfo.topic}
                    </h2>
                </header>

                <div className="audio-call-avatar">
                    {contact && avatarUrl ? (
                        <img src={avatarUrl} alt="" />
                    ) : (
                        contact?.displayName.slice(0, 1)
                    )}

                    <h3 className="audio-call-name">
                        {contact?.displayName ?? "Waiting for someone to join"}
                    </h3>
                    <span role="status" className="audio-call-status">
                        {audioState.isJoined
                            ? "Audio connected"
                            : connected
                              ? "Join audio to talk"
                              : "Connecting…"}
                    </span>
                    <small className="audio-call-self">
                        You’re {participantState.currentUser?.displayName}
                    </small>
                </div>
                <footer>
                    <div>
                        <AudioButton
                            showMenu={false}
                            className="audio-call-button"
                        />
                        <p>{audioLabel}</p>

                        <ChatButton className="audio-call-button" />
                        <p>Chat</p>

                        <LeaveButton className="audio-call-button" />
                        <p>Leave</p>
                    </div>
                    <p className="audio-call-summary">
                        {participantState.participants.length}{" "}
                        {participantState.participants.length === 1
                            ? "participant"
                            : "participants"}{" "}
                        · Audio only
                    </p>
                </footer>
            </section>
        </ThemeProvider>
    );
}
```

```css
/* MeetingLayout.css */
.audio-call {
    width: 100%;
    max-width: 380px;
    min-height: 620px;
    padding: 28px;
    box-sizing: border-box;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: #ffffff;
    color: #183c42;
    border: 1px solid #dfe8eb;
    border-radius: 32px;
    font-family: system-ui, sans-serif;
}

.audio-call-label {
    font-size: 11px;
    letter-spacing: 2px;
    color: #647c82;
}

.audio-call-topic {
    margin: 8px 0 0;
    font-size: 21px;
}

.audio-call-contact {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 14px;
}

.audio-call-avatar {
    width: 156px;
    height: 156px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: #edf5f4;
    border: 8px solid #edf5f4;
    box-sizing: border-box;
    font-size: 48px;
}

.audio-call-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.audio-call-name {
    margin: 0;
    font-size: 28px;
}

.audio-call-status {
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 13px;
    background: #eaf6ee;
    color: #28734a;
}

.audio-call-self {
    color: #647c82;
}

.audio-call-controls {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    text-align: center;
}

.audio-call-button {
    width: 64px;
    height: 64px;
}

.audio-call-summary {
    margin: 12px 0 0;
    color: #647c82;
    font-size: 12px;
    text-align: center;
}
```

![UI Toolkit audio call](/img/uitk2-doc-audio-call.png)

### Group components for stacking

Wrap a custom layout in `ZoomUIToolkitRoot` when you need its toolkit components to form one stacking group relative to the rest of your page. The wrapper is optional and uses the provider’s `baseZIndex` (default `1000`). `ZoomUIToolkitApp` creates this group automatically in App mode.

Set `baseZIndex` on `ZoomUIToolkitProvider` to move the group and its built-in overlays together. Panels, menus, dialogs, and mobile sheets keep their relative layer order. Overlays rendered through portals also use the provider’s base, even when they render outside the root.

Place the root inside your existing session provider. Here, `MeetingLayout` is the layout from Build a normal video layout:

```tsx
import {
    ZoomUIToolkitProvider,
    ZoomUIToolkitRoot,
} from "@zoom/videosdk-ui-toolkit";
import { MeetingLayout } from "./MeetingLayout";

<ZoomUIToolkitProvider clientInstance={client} baseZIndex={2000}>
    <ZoomUIToolkitRoot>
        <MeetingLayout />
    </ZoomUIToolkitRoot>
</ZoomUIToolkitProvider>;
```

With `baseZIndex={2000}`, the root sits at `2000` and the panels, menus, dialogs, bottom sheets, and reclaim-host banner it opens use values from `2001` up to `2007`. Keep sizing and layout styles on your own container inside the root. Choose `baseZIndex` relative to the surrounding page’s layers; ancestor stacking contexts still apply.

### Try the components in the sample

Choose **Components** on the official React sample’s join screen and select the components you want to try. After joining, use the editor to adjust props, size, and colors, switch between light and dark themes or desktop and mobile presets, and copy component code.

The sample’s `src/ComponentsPlayground.tsx` and `src/componentsPlayground/` show how the component previews and editor are built.

## Platform setup

Use these settings when adding the toolkit to an existing React 19 app or deploying the Quickstart. The complete client, auth request, provider, and session UI are shown together in **Quickstart**.

### Install the packages

```bash
npm install @zoom/videosdk-ui-toolkit@2.6.0-2 @zoom/videosdk react react-dom
```

| Peer dependency | Minimum version in the publish manifest |
| --------------- | --------------------------------------- |
| @zoom/videosdk  | 2.6.0                                   |
| react           | 19.0.0                                  |
| react-dom       | 19.0.0                                  |

### Browser requirements and cross-origin isolation

The toolkit does not make COOP/COEP headers a prerequisite for rendering the UI or joining a session. Media capabilities depend on the underlying Video SDK, browser, and video mode. Without cross-origin isolation, `SharedArrayBuffer` is unavailable. For example, 720p sending through WebAssembly video requires it, while WebRTC video does not; some virtual-background configurations require it too. Configure isolation for the fullest supported media capabilities and check the [Video SDK browser support matrix](/docs/video-sdk/web/browser-support/) for your target environment.

Use HTTPS in production or localhost for development, then set `Cross-Origin-Opener-Policy: same-origin` and `Cross-Origin-Embedder-Policy: require-corp` on the page response. Adding them to a client fetch request does not isolate the page.

With `require-corp`, third-party resources must load through compatible CORS or CORP policies; otherwise images, fonts, scripts, or other assets can be blocked. Verify these resources after enabling the headers. See [COEP behavior and resource requirements](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cross-Origin-Embedder-Policy).

```js
// Check in the browser console after the page reloads.
window.crossOriginIsolated; // true when isolation is configured correctly
typeof SharedArrayBuffer; // 'function' when available
```

### Vite

Set the headers on both the dev server and preview. Configure the same response headers on your production host.

```ts
// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
const headers = {
    "Cross-Origin-Opener-Policy": "same-origin",
    "Cross-Origin-Embedder-Policy": "require-corp",
};
export default defineConfig({
    plugins: [react()],
    server: { headers },
    preview: { headers },
});
```

### Next.js

Add response headers in `next.config.js` and restart the server. This example applies them to every path; scope them to your session route if your application requires different policies elsewhere. See the [Next.js headers configuration](https://nextjs.org/docs/app/api-reference/config/next-config-js/headers).

```js
// next.config.js
module.exports = {
    async headers() {
        return [
            {
                source: "/:path*",
                headers: [
                    { key: "Cross-Origin-Opener-Policy", value: "same-origin" },
                    {
                        key: "Cross-Origin-Embedder-Policy",
                        value: "require-corp",
                    },
                ],
            },
        ];
    },
};
```

`@zoom/videosdk` only runs in the browser; importing it on the server fails with `window is not defined`. Next.js also renders Client Components on the server for the first page load, so load the session screen with `next/dynamic` and `ssr: false`. Copy the Quickstart's `App.tsx`, `Viewport.tsx`, `config.ts`, and `auth.ts` into `components/`, and import the stylesheet once from `app/layout.tsx` instead of `main.tsx`.

```tsx
// app/session/page.tsx
"use client";
import dynamic from "next/dynamic";
const App = dynamic(
    () => import("../../components/App").then((mod) => mod.App),
    {
        ssr: false,
        loading: () => <p>Loading the video session…</p>,
    },
);
export default function SessionPage() {
    return <App />;
}
```

```tsx
// app/layout.tsx (add alongside your other global CSS imports)
import "@zoom/videosdk-ui-toolkit/style.css";
```

### Integrate the Quickstart into your app

Keep one initialized SDK client and one `ZoomUIToolkitProvider` for the session screen.

If your app already has an entry point, render `App` from it and import the stylesheet once, as the Quickstart's `main.tsx` does.

`requestSessionToken` in `auth.ts` requests `{ sessionName, role, videoWebRtcMode: 1 }` from the auth server and returns `signature`; `joinSession` in `Viewport.tsx` passes it to `client.join()`. The token's session name must match the join topic. Replace `config.authEndpoint` with your own authenticated endpoint in production.

To use `JoinButton`, fetch a server-issued signature first and pass it as `joinParameters.token`; see the `JoinButton` example in the API reference. `JoinButton` does not fetch or validate the token for you. It is disabled until the client, topic, and user name are ready, and while joining. Show join errors from `sessionState.errorMessage`.

## Migration from Existing UI Toolkit

_Before or equal to version 2.6.0-1._

Read this section when updating an existing UI Toolkit integration. New integrations can start with the official React sample and the mode guides.

UI Toolkit Modular is a React rewrite of the UI Toolkit. It keeps the two ways of working from the composite UI Toolkit before or equal to version 2.6.0-1 (a prebuilt experience and individual building blocks) and replaces the imperative JavaScript API with React components, props, and hooks.

|                     | Existing UI Toolkit (< = 2.6.0-1)                                                                           | UI Toolkit Modular for React                                                                                                                             |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Prebuilt experience | Composite mode: `uitoolkit.joinSession(container, config)`                                                  | App mode: `<ZoomUIToolkitApp />` inside `<ZoomUIToolkitProvider>`                                                                                        |
| Building blocks     | Component mode: `showControlsComponent`, `showChatComponent`, `showUsersComponent`, `showSettingsComponent` | Component mode: 7 modules and 20+ components such as `<Toolbar />`, `<ParticipantView />`, `<ChatButton />`, `<ParticipantPanel />`, `<SettingsPanel />` |
| Configuration       | `featuresOptions` flags in a config object                                                                  | Props: `toolbarProps.visibleButtons`, per-button props, and provider `sessionOptions`                                                                    |
| Joining             | `videoSDKJWT`, `sessionName`, `userName` in the config                                                      | `<JoinButton joinParameters={{ topic, token, userName }} />` or `client.join()`                                                                          |
| Session events      | `onSessionJoined`, `onSessionClosed`                                                                        | `useZoomUIToolkit().sessionState.connectionState`                                                                                                        |
| Leaving             | `uitoolkit.closeSession()`, `uitoolkit.destroy()`                                                           | `<LeaveButton />` or `client.leave()`                                                                                                                    |
| Theme               | `theme` feature option                                                                                      | `theme='dark'` or `'light'` on the provider, `<ThemeProvider>` for part of a layout                                                                      |
| Mobile              | Verify the behavior of your existing integration                                                            | Automatic mobile layout: swipeable video pages, bottom sheets, and a compact toolbar                                                                     |
| Video SDK client    | Created by the toolkit                                                                                      | Created and initialized by your app and passed to the provider                                                                                           |
| Styles              | `@zoom/videosdk-ui-toolkit/dist/videosdk-ui-toolkit.css`                                                    | `@zoom/videosdk-ui-toolkit/style.css`                                                                                                                    |
| Distribution        | npm, UMD, and ESM from the CDN                                                                              | npm (ES module) for React 19                                                                                                                             |

Replace container-based rendering calls with React components, create and initialize the client in your app, and pass it to a single provider. Move configuration into app/button props and `sessionOptions`. Track connection state with `useZoomUIToolkit`, and replace session close calls with `LeaveButton` or `client.leave()`. Update the stylesheet import.

### Resources

-   [Video SDK for web](/docs/video-sdk/web/)
-   Integration guide and machine-readable API shipped with the package: `skills/uitoolkit-integration/` (`SKILL.md`, `app.md`, `components/`, `modules/`, and the `api/` JSON contracts)
