How do target configurations and design attributes work in the component's .js-meta.xml file?
Answer
Basics: Every LWC bundle has a metadata file. isExposed makes it visible to builders; masterLabel and description name it in App Builder; targets list placements such as lightning__RecordPage, lightning__AppPage, lightning__HomePage, lightning__Tab, lightning__RecordAction, lightning__FlowScreen, lightning__UtilityBar and lightningCommunity__Page. Without exposure and targets, the component is only usable inside other components.
How it works: Under <targetConfigs>, each <targetConfig targets="..."> can include <property> elements (design attributes) that map to @api fields. Attributes: name (must match the @api property), type (String, Integer, Boolean, Color in supported contexts), label, description, default, required, min/max, datasource (comma list for a picklist, or apex://ClassName for dynamic values). Restrict record pages to specific objects with <objects><object>Account</object></objects>, and flow screens use role="inputOnly" or outputOnly. For quick actions, add lightning__RecordAction with <actionType>ScreenAction</actionType> or Action.
Advanced / deep dive: recordId and objectApiName are auto-supplied on record pages and need no property definition, only . restricts to Large/Small. Properties can differ per target by using separate blocks. Dynamic picklists use an Apex class extending and are referenced via . Changes to the XML require redeploy and sometimes a builder refresh. In managed packages, exposed components become part of the package API. If an property has a setter-only or complex type (object, array) it cannot be exposed in the builder; take String/JSON and parse.