--- description: 'Guidelines and best practices for developing Lightning Web Components (LWC) on Salesforce Platform.' applyTo: 'force-app/main/default/lwc/**' --- # LWC Development ## General Instructions - Each LWC should reside in its own folder under `force-app/main/default/lwc/`. - The folder name should match the component name (e.g., `myComponent` folder for the `myComponent` component). - Each component folder should contain the following files: - `myComponent.html`: The HTML template file. - `myComponent.js`: The JavaScript controller file. - `myComponent.js-meta.xml`: The metadata configuration file. - Optional: `myComponent.css` for component-specific styles. - Optional: `myComponent.test.js` for Jest unit tests. ## Core Principles ### 1. Use Lightning Components Over HTML Tags Always prefer Lightning Web Component library components over plain HTML elements for consistency, accessibility, and future-proofing. #### Recommended Approach ```html ``` #### Avoid Plain HTML ```html ``` ### 2. Lightning Component Mapping Guide | HTML Element | Lightning Component | Key Attributes | |--------------|-------------------|----------------| | `