Skip to main content
The CometChat Calls SDK provides three layout modes to display participants during a call. Each participant can independently choose their preferred layout without affecting others.

Available Layouts

LayoutDescriptionBest For
TILEGrid layout with equally-sized tilesGroup discussions, team meetings
SIDEBARMain speaker with participants in a sidebarPresentations, webinars
SPOTLIGHTLarge view for active speaker, small tiles for othersOne-on-one calls, focused discussions

Set Initial Layout

Configure the initial layout when joining a session using the layout property in session settings:
const callSettings = {
  layout: "TILE", // or "SIDEBAR" or "SPOTLIGHT"
  // ... other settings
};

await CometChatCalls.joinSession(callToken, callSettings, container);

Change Layout During Call

Change the layout dynamically during an active call:
// Switch to tile layout
CometChatCalls.setLayout("TILE");

// Switch to sidebar layout
CometChatCalls.setLayout("SIDEBAR");

// Switch to spotlight layout
CometChatCalls.setLayout("SPOTLIGHT");

Listen for Layout Changes

Monitor when the layout changes:
CometChatCalls.addEventListener("onCallLayoutChanged", (layout) => {
  console.log("Layout changed to:", layout);
});

Hide Layout Controls

To prevent users from changing the layout, hide the layout change button:
const callSettings = {
  hideChangeLayoutButton: true,
  // ... other settings
};

Layout Constants

Access layout constants through the SDK:
const layouts = CometChatCalls.constants.LAYOUT;

console.log(layouts.TILE);      // "TILE"
console.log(layouts.SIDEBAR);   // "SIDEBAR"
console.log(layouts.SPOTLIGHT); // "SPOTLIGHT"