Search code examples
javascriptgoogle-chrome-extension

How to add chrome tab group in javascript?


I'm currently working on my first chrome extension (MV3) and I wanted to add a new tab group through js. The documentation say it's possible, but I just can't figure out how to do it. All help is appreciated! :)


Solution

  • I took a look at a similar chrome extension and managed to figure it out. You do something along the lines of:

    async function test() {
      const groupId = await chrome.tabs.group({ tabIds: tabId });
      chrome.tabGroups.update(groupId, { collapsed: false, title: "title", color: "blue" });
    }