Back to Content

tabGroups

files/en-us/mozilla/add-ons/webextensions/api/tabgroups/index.md

latest2.2 KB
Original Source

This API enables extensions to modify and rearrange tab groups.

Tab groups may persist across browser restarts as part of session restore. Tab groups in private browsing windows do not persist across restarts. When a tab group is restored, its groupId may differ from its original value.

The tabGroups API doesn't offer the ability to create or remove tab groups. Use the {{WebExtAPIRef("tabs.group()")}} and {{WebExtAPIRef("tabs.ungroup()")}} methods instead. To query the position of a tab group within a window, use {{WebExtAPIRef("tabs.query()")}}. These APIs in the tabs namespace don't require any permissions.

Permissions

To use this API, an extension must request the "tabGroups" permission in its manifest.json file. The "tabGroups" permission is not shown to users in permission prompts.

Types

  • {{WebExtAPIRef("tabGroups.Color")}}
    • : The color of a tab group.
  • {{WebExtAPIRef("tabGroups.TabGroup")}}
    • : The state of a tab group.

Properties

  • {{WebExtAPIRef("tabGroups.TAB_GROUP_ID_NONE")}}
    • : The tab group ID value returned when a tab isn't in a tab group.

Functions

  • {{WebExtAPIRef("tabGroups.get()")}}
    • : Returns details about a tab group.
  • {{WebExtAPIRef("tabGroups.move()")}}
    • : Moves a tab group within or to another window.
  • {{WebExtAPIRef("tabGroups.query()")}}
    • : Returns all tab groups or finds tab groups with certain properties.
  • {{WebExtAPIRef("tabGroups.update()")}}
    • : Modifies the state of a tab group.

Events

  • {{WebExtAPIRef("tabGroups.onCreated")}}
    • : Fires when a tab group is created.
  • {{WebExtAPIRef("tabGroups.onMoved")}}
    • : Fires when a tab group is moved within a window or to another window.
  • {{WebExtAPIRef("tabGroups.onRemoved")}}
    • : Fires when a tab group is removed.
  • {{WebExtAPIRef("tabGroups.onUpdated")}}
    • : Fires when a tab group is updated.

{{WebExtExamples("h2")}}

Browser compatibility

{{Compat}}

See also

  • {{WebExtAPIRef("tabs.group()")}}
  • {{WebExtAPIRef("tabs.ungroup()")}}
  • {{WebExtAPIRef("tabs.query()")}}
  • {{WebExtAPIRef("tabs.Tab")}}