How to remove Lightning App Page Header [LWC]
In this tutorial, I will show you how to remove Lightning App Page Header using Lightning Web Components and CSS. In the images below you can see the final result.
Before
After
Create a CSS-File and paste the “noHeader.resource” Code-Snippet. Then create a Static Resource and upload it.
noHeader.resource
.slds-page-header.header.flexipageHeader {
display: none;
}
exampleComponent.js
import {LightningElement} from 'lwc';
//Import your CSS-File from the Static Resources
import noHeader from '@salesforce/resourceUrl/NoHeader';
//Import loadStyle-Method
import {loadStyle} from "lightning/platformResourceLoader";
export default class LwcExampleComponent extends LightningElement {
connectedCallback() {
loadStyle(this, noHeader)
.then(result => {});
}
}
That’s it!
I hope you have enjoyed learning “How to remove Lightning App Page Header [LWC]”. Please share your thoughts in the comments below. If you find value in this type of post, please subscribe because we have tons of tutorials in progress to be posted!
If you prefer to see the result with Lightning Aura Components, here’s the link to it: How to remove Lightning App Page Header [Aura].
Leave a comment!
Hamid Abassi
SfWiki Founder
I am a Salesforce Developer from Hamburg who wants to help the Salesforce Community around the world with my tutorials. Feel free to explore my website and hopefully learn something new.