Salesforce LWC Developer Notes repository, including installation, code example, run steps, and troubleshooting — all in professional GitHub markdown:
This repository contains well-structured, beginner-to-advanced level notes for Salesforce Lightning Web Components (LWC) development. It's designed as a quick reference guide and a personal learning tracker to support developers preparing for Salesforce developer roles, certifications, or real-world projects.
- ✅ HTML5 essentials in LWC context
- ✅ LWC directives and templating syntax (
if:true
,for:each
, etc.) - ✅ Base Lightning Components usage (
lightning-button
,lightning-input
, etc.) - ✅ SLDS utility classes for consistent Lightning styling
- ✅ Component composition and data binding
- ✅ Event handling and custom event examples
- ✅ Handy markdown documentation for GitHub readability
# Mac
brew install sfdx-cli
# Windows & Linux
# Download manually:
https://developer.salesforce.com/tools/sfdxcli
sfdx auth:web:login -a myDevHub
This opens your browser to login. Use a Developer Edition org or Sandbox.
sfdx force:project:create -n myLWCProject
cd myLWCProject
# Login to your org → Setup → Dev Hub → Enable
sfdx force:org:create -s -f config/project-scratch-def.json -a lwcScratch
sfdx force:source:push
sfdx force:org:open
sfdx force:lightning:component:create \
--type lwc \
--componentname helloWorld \
--outputdir force-app/main/default/lwc
<template>
<div class="slds-box slds-theme_default">
<h1>Hello, {name} 👋</h1>
<lightning-input label="Your Name" onchange={handleChange}></lightning-input>
</div>
</template>
import { LightningElement } from 'lwc';
export default class HelloWorld extends LightningElement {
name = 'Trailblazer';
handleChange(event) {
this.name = event.target.value;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>60.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
-
Open your scratch org:
sfdx force:org:open
-
In the org UI, go to App Builder
-
Add
helloWorld
to a Lightning Page -
Save and Activate the page
-
Preview it live!
❌ Error | ✅ Reason | 🛠️ Fix |
---|---|---|
Component not visible | Missing isExposed or targets |
Add <isExposed>true</isExposed> + valid targets |
undefined input value |
Missing event.target.value |
Use this.name = event.target.value; |
Push fails | Invalid folder path or file format | Use correct folder: force-app/main/default/lwc |
Not loading styles | Missing SLDS class or static CSS | Use official SLDS utility classes |
Component not reactive | No tracked/public decorators used | Add @track or expose properties with @api |
sfdx force:org:list # List all connected orgs
sfdx force:source:status # View local vs org changes
sfdx force:source:pull # Pull updates from org
sfdx force:source:deploy -p force-app # Deploy to any org
🙌 Contributions are welcome! Feel free to submit issues, ideas, or PRs to expand this reference for fellow Trailblazers.
MIT License – Use freely, just give credit where due!
Made with 💙 by Maheswari Pinneti ✨ Fork it, star it, and make it your own Salesforce dev vault!