is live. Lifetime & Yearly plans on offer. thankful for you ๐Ÿงก

Get the Black Friday deal

LWC

LWC js-meta.xml: Targets, targetConfigs and Properties Explained

Every LWC js-meta.xml target and targetConfig explained: record pages, Flow screens, Experience Cloud (lightningCommunity__Page), properties and common errors.

By Teja, ex-Salesforce engineer ยท Updated November 26, 2026 ยท 5 min read

LWC

The js-meta.xml file decides where a Lightning Web Component can be used and what an admin can configure when they drop it on a page. <targets> lists the places (record page, app page, Flow screen, Experience Cloud page and so on). <targetConfigs> adds settings for each of those places: design properties, the objects a record page component supports, form factors, and Flow input and output roles. If a component is missing from App Builder, or a property doesn't show up, the cause is almost always in this file.

Below: the full structure of the file, each common target, targetConfig options for record pages, Flow screens and Experience Cloud, and the errors I see most often.

The structure of a js-meta.xml file

Every component folder has one. For a component called accountSummary, the file is accountSummary.js-meta.xml.

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>62.0</apiVersion>
    <isExposed>true</isExposed>
    <masterLabel>Account Summary</masterLabel>
    <description>Shows rating, industry and open cases for an account.</description>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordPage">
            <property name="showCases" type="Boolean" default="true" label="Show open cases" />
            <objects>
                <object>Account</object>
            </objects>
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>

What each tag does:

  • apiVersion: the API version the component compiles against. Use the latest version your org supports.
  • isExposed: true makes the component available to the builders (App Builder, Experience Builder, Flow Builder). With false, other components can still use it as a child, but admins can't place it.
  • masterLabel: the name admins see in the component palette. Without it, they see the folder name.
  • description: shown in the builder as a tooltip.
  • targets: where the component can be placed.
  • targetConfigs: extra settings per target. Every target you name inside a targetConfig must also be in <targets>.

One thing to keep in mind: if the component ships in a managed package, you can't set isExposed back to false after the package is released. Decide early.

The targets you'll use most

TargetWhere the component shows up
lightning__RecordPageLightning record pages in App Builder
lightning__AppPageApp pages in App Builder
lightning__HomePageHome pages in App Builder
lightning__TabA custom Lightning component tab
lightning__UtilityBarThe utility bar of a Lightning app
lightning__RecordActionA quick action on a record page
lightning__FlowScreenA screen component in Flow Builder
lightningCommunity__PageThe Experience Builder component palette
lightningCommunity__DefaultEditable properties in Experience Builder
lightning__InboxThe Outlook and Gmail integration panes

Salesforce adds new targets from release to release, so check the targets reference when you need something less common.

targetConfig for record pages: properties, objects and form factors

A record page component usually wants two things: the current record, and a few settings the admin can change.

<targets>
    <target>lightning__RecordPage</target>
</targets>
<targetConfigs>
    <targetConfig targets="lightning__RecordPage">
        <property name="title" type="String" default="Account health" label="Card title" />
        <property name="maxRows" type="Integer" default="5" min="1" max="20" label="Rows to show" />
        <property name="priority" type="String" datasource="Low,Medium,High" default="Medium" label="Minimum priority" />
        <objects>
            <object>Account</object>
            <object>Opportunity</object>
        </objects>
        <supportedFormFactors>
            <supportedFormFactor type="Large" />
            <supportedFormFactor type="Small" />
        </supportedFormFactors>
    </targetConfig>
</targetConfigs>
  • property shows up as a field in the App Builder panel on the right. type can be Boolean, Integer or String here. A datasource with comma-separated values turns a String into a picklist.
  • objects limits the component to the record pages of those objects. Leave it out and the component is available on every object's record page.
  • supportedFormFactors says whether the component runs on desktop (Large), phone (Small) or both.

Each property needs a matching @api field in JavaScript, with exactly the same name:

import { LightningElement, api } from 'lwc';

export default class AccountHealth extends LightningElement {
    @api recordId;
    @api objectApiName;

    @api title;
    @api maxRows;
    @api priority;
}

recordId and objectApiName are not design properties. You don't list them in the XML. On a record page, Salesforce fills them in for you as long as you declare them with @api.

targetConfig for Flow screens: inputs, outputs and record types

A Flow screen component has two-way traffic. The flow passes values in, and the component passes values back.

<targets>
    <target>lightning__FlowScreen</target>
</targets>
<targetConfigs>
    <targetConfig targets="lightning__FlowScreen">
        <property name="account" type="@salesforce/schema/Account" label="Account" role="inputOnly" />
        <property name="startDate" type="Date" label="Start date" role="inputOnly" />
        <property name="selectedContacts" type="@salesforce/schema/Contact[]" label="Selected contacts" role="outputOnly" />
        <property name="notes" type="String" label="Notes" />
    </targetConfig>
</targetConfigs>
  • role="inputOnly": the flow can set it, but can't read it back.
  • role="outputOnly": the flow can read it, but can't set it.
  • No role: both directions.
  • Types: Flow supports more types than App Builder. Boolean, Date, DateTime, Integer and String, records with @salesforce/schema/Account, collections with [], and Apex-defined types with apex://ClassName.

To send a value back, change the property and tell the flow about it:

import { LightningElement, api } from 'lwc';
import { FlowAttributeChangeEvent } from 'lightning/flowSupport';

export default class ContactPicker extends LightningElement {
    @api account;
    @api startDate;
    @api selectedContacts = [];
    @api notes;

    handleSelection(event) {
        this.selectedContacts = event.detail.rows;
        this.dispatchEvent(new FlowAttributeChangeEvent('selectedContacts', this.selectedContacts));
    }
}

If you only change the property and skip the event, the flow often still sees the old value. That's the bug I get asked about most for Flow screen components. More on this in using an LWC in Salesforce Flows.

targetConfig for Experience Cloud: lightningCommunity__Page vs lightningCommunity__Default

This is where most people get confused, because Experience Cloud uses two targets for one job.

  • lightningCommunity__Page puts the component in the Experience Builder component palette, so a site admin can drag it onto a page.
  • lightningCommunity__Default lets the site admin edit the component's properties in Experience Builder. Properties go in a targetConfig for this target.

So a configurable component needs both:

<targets>
    <target>lightningCommunity__Page</target>
    <target>lightningCommunity__Default</target>
</targets>
<targetConfigs>
    <targetConfig targets="lightningCommunity__Default">
        <property name="heading" type="String" default="Our latest products" label="Heading" />
        <property name="showPrices" type="Boolean" default="true" label="Show prices" />
        <property name="cardsPerRow" type="Integer" default="3" label="Cards per row" />
        <property name="accentColor" type="Color" default="#0176d3" label="Accent color" />
        <property name="recordId" type="String" default="{!recordId}" label="Record ID" />
    </targetConfig>
</targetConfigs>

Two details that trip people up:

  • recordId on Experience Cloud pages is not filled in automatically. Add it as a property with default="{!recordId}", as above, and the builder binds it to the record in the page URL.
  • Experience Builder supports a Color type that App Builder doesn't. Admins get a color picker.

For custom page and theme layouts there are two more targets: lightningCommunity__Page_Layout and lightningCommunity__Theme_Layout.

One component, several targets

You can list several targets and give each its own settings. A targetConfig can also cover more than one target with a comma-separated list.

<targets>
    <target>lightning__RecordPage</target>
    <target>lightning__AppPage</target>
    <target>lightning__HomePage</target>
</targets>
<targetConfigs>
    <targetConfig targets="lightning__RecordPage">
        <property name="showCases" type="Boolean" default="true" />
        <objects>
            <object>Account</object>
        </objects>
    </targetConfig>
    <targetConfig targets="lightning__AppPage, lightning__HomePage">
        <property name="title" type="String" default="My accounts" />
    </targetConfig>
</targetConfigs>

Your JavaScript then has to cope with properties that are empty on some pages. Give every @api property a sensible default in code, not just in the XML. The XML default only applies when an admin first drops the component on a page.

Errors I see most often

  1. The component doesn't appear in the builder. isExposed is false, the page type isn't in targets, or objects doesn't include the object you're editing.
  2. The deploy fails on a targetConfig. The targets attribute names a target that isn't in <targets>. Every target in a targetConfig must be listed in <targets> too.
  3. A property doesn't show up. The property is in a targetConfig for a different target. For Experience Cloud it must be under lightningCommunity__Default, not lightningCommunity__Page.
  4. The property name doesn't match the @api field. Names are case-sensitive. maxRows in XML and maxrows in JS are two different things. Also, don't start a property name with on, because the framework treats those as event handlers.
  5. A Flow output stays empty. The component never dispatched FlowAttributeChangeEvent.
  6. A changed default does nothing. Defaults only apply to new placements. Pages that already use the component keep the value they were saved with.

If you want the full list of where a component can live, I wrote a shorter overview in sourcing LWC in Lightning. For building these components step by step in a real org, see the Lightning Web Components course.

Learn it by building it

Every course, every code repository, the discussion group and certificates of completion โ€” one subscription.

Frequently asked questions

What is the difference between targets and targetConfigs in js-meta.xml?

targets decides where a component can be placed, such as a record page or a Flow screen. targetConfigs adds settings for those places: the properties an admin can fill in, the objects a record page component supports, and the form factors it runs on.

Do I need both lightningCommunity__Page and lightningCommunity__Default?

Add lightningCommunity__Page to show the component in the Experience Builder palette. Add lightningCommunity__Default, with a targetConfig, when you also want admins to edit its properties in Experience Builder. Most components need both.

Why doesn't my LWC show up in App Builder?

Check that isExposed is true, that the page type you're building is listed in targets, and that the record page's object is listed in objects if you used that tag. Then deploy again and refresh the builder.

How does a Flow screen get a value back from an LWC?

Mark the property as outputOnly (or leave role out), declare it with @api in JavaScript, and dispatch a FlowAttributeChangeEvent from lightning/flowSupport whenever the value changes.

Keep going

Keep me in the loop!

Email me when a new episode is published (promise, I will not spam you)

You're signing up to receive emails from Salesforce Casts