33. How can we get the current Experience Builder Site?
We can import information about the current Experience Builder site from the @salesforce/community scoped module.
import propertyName from '@salesforce/community/property';Supported properties include:
- Id — the ID of the current site.
- basePath — the section of the site’s URL that comes after the domain. For example, if your site domain is
newstechnologystuff.force.comandlwcdemowas the URL value added when you created the site, the community’s URL isnewstechnologystuff.force.com/lwcdemo/s. In this case,lwcdemo/sis the base path.
// demoSite.js
import { LightningElement } from 'lwc';
import Id from '@salesforce/community/Id';
export default class CommunityPage extends LightningElement {
// component logic here
}34. How do we access LWC in Lightning App Builder?
We need to use targets to define where we want to use the LWC component. The example below supports the Record Page, Home Page, and App Page. We also need to set isExposed to true, and we can provide different properties on different screens using targetConfigs.
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>51.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>Demo Component</masterLabel>
<description>This is a demo component from NewsTechnologyStuff.</description>
<targets>
<target>lightning__RecordPage</target>
<target>lightning__AppPage</target>
<target>lightning__HomePage</target>
</targets>
<targetConfigs>
<targetConfig targets="lightning__RecordPage">
<property name="prop1" type="String" />
<objects>
<object>Account</object>
<object>Contact</object>
<object>CustomObject__c</object>
</objects>
</targetConfig>
<targetConfig targets="lightning__AppPage, lightning__HomePage">
<property name="prop2" type="Boolean" />
</targetConfig>
</targetConfigs>
</LightningComponentBundle>35. What are all the supported targets for LWC?
Experience Builder:
To make your component usable in Experience Builder, set isExposed to true. Then, in targets, add one of these values:
lightningCommunity__Page— create a drag-and-drop component that appears in the Components panellightningCommunity__Page_Layout— create a page layout component for LWR sites that appears in the Content Layout windowlightningCommunity__Theme_Layout— create a theme layout component for LWR sites that appears in Settings, in the Theme area
To include properties that are editable when the component is selected in Experience Builder, define lightningCommunity__Default in targets and define the properties in targetConfigs. Only properties defined for the lightningCommunity__Page or lightningCommunity__Page_Layout targets are editable in Experience Builder.
Utility Bar:
<target>lightning__UtilityBar</target>Outlook and Gmail:
<target>lightning__Inbox</target>Flow (screen actions and, as of Winter ’26, local actions):
<target>lightning__FlowScreen</target>Outside Salesforce entirely: as of Winter ’26, custom LWC can also be embedded in external, non-Salesforce apps using Lightning Out 2.0 (see Part 3, Question 22) — this doesn’t use the targets configuration above, but is configured separately as a Lightning Out 2.0 app in Setup.
For further reading, see the official Lightning Web Components documentation.
This concludes the 4-part Lightning Web Components Interview Questions series — 35 questions from beginner through 2026-current, interview-ready material.