Is there any way we can display LWC as a separated page similar to VisualForce page? I know we can create an app than aura component which holds LWC component on VFP but we don't want to use VFP at all. We can open LWC component in a tab with full width but the top header - salesforce navigation is there. I know we can overwrite css to not display salesforce top header but this I would find as a not good practice. So the question is is there any other way to display LWC as a full width and height page without VFP?
1 Answer
You can use a Lightning App. Like a VFP, they are addressable via a URL:
https://mydomain.lightning.force.com/my_ns/appName.app
Which you write as:
<aura:application extends="force:slds">
<c:myLwc />
</aura:application>
You can also just add the lightning__AppPage target and and make a full page app if you prefer, though it would then have some minor padding on all sides, etc.
-
Thanks for your response, how to actually preview it somewhere or add it to app exchange to check if it works? my-domain.lightning.force.com/lightning/myAppName.app doesnt work at all– panatoniApr 16, 2021 at 11:19
-
@panatoni You need to create the app (you can use Developer Console for this). Also, I should mention you can run a Local Lightning Server if you're using SFDX: developer.salesforce.com/docs/component-library/documentation/…– sfdcfoxApr 16, 2021 at 11:23
-
I did it but it still display salesforce navigation on top as you can see on the screen the component which is black header has a full width but it's still "inside" the salesforce imgur.com/a/A67579R– panatoniApr 16, 2021 at 11:43
-
@panatoni If you use a Lightning App, it will be completely self-contained. imgur.com/a/0YaASbY– sfdcfoxApr 16, 2021 at 11:50
-
what is my_ns in the url ? I added and deployed an app using aura:application but once I'm putting it in similar way in the url it simply says page doesnt exist.– panatoniApr 16, 2021 at 12:36