I have a LWC that runs inside a custom SF tab, I want to know how to change the browser tab name ?

I only managed to find this answer but it is for aura.

2 Answers 2


document.title still works fine, the issue is it gets overriden by the record name if the lwc component is on a record page, rest for an app page it works fine.

So you can try giving it a timeout if its a record page.

connectedCallback() {
    setTimeout(function (){
        document.title = 'Test Me Please';

Or just try by removing the settimout if its a app page:

connectedCallback() {
        document.title = 'Test Me Please';    
  • 2
    It is not possible to use "setTimeout" in a LWC though. I'd say it is not worth the effort to rename the tab at all. Nov 23, 2020 at 13:22
  • 1
    Why is it not possible to use settimeout in lwc? Any reason? Nov 23, 2020 at 13:27
  • It is explained in this other Q&A: salesforce.stackexchange.com/questions/261416/… Nov 23, 2020 at 14:25
  • 1
    Its just a es-lint plugin which gives a warning. Though from LWC its not restricted, though for above scenario as its a custom app, I think there is not need of setTimeout Nov 23, 2020 at 14:42
  • Hi @NagendraSingh, document.title did the trick (without setTimeout), thank you.
    – Json
    Nov 23, 2020 at 14:50

UPDATE: It's now possible to update the console tab name (& icon) from the LWC itself

I did the following having a custom tab displaying a LWC.

You need to import the following functions from the platform workspace API in your LWC js controller

import { setTabLabel, getFocusedTabInfo, setTabIcon } from "lightning/platformWorkspaceApi";

And then, for example, in the connectedCallBack

connectedCallback() {
    getFocusedTabInfo().then((tabInfo) => {
        setTabLabel(tabInfo.tabId, "MyTabName");
        setTabIcon(tabInfo.tabId, "custom:custom90");

(Icon id is coming from the SLDS Icons)

  • Does this change the browser's tab?
    – Nick C
    Mar 26 at 1:36
  • No the console tab as highlighted in my answer
    – Charles dB
    Mar 26 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .