Salesforce Lightning Web Component

Salesforce

LWC for Flow in Salesforce

HTML: <template>     <lightning-datatable key-field="Id"                          data={contacts}                          columns={columns}                          hide-checkbox-column="true"                          show-row-number-column="true"                          onrowaction={handleRowAction}>     </lightning-datatable> </template> JavaScript: import { LightningElement, api, track } from 'lwc'; import { NavigationMixin ....

Salesforce

lightning-accordion – Expand and Collapsible sections in LWC

Sample Code: HTML: <template>     <div class="slds-box slds-theme_default">         <lightning-accordion class="example-accordion"                             onsectiontoggle={handleToggleSection}                             allow-multiple-sections-open>             <lightning-accordion-section name="A" label="Accordion Title A">                 Test             </lightning-accordion-section>         </lightning-accordion>      </div>    </template> ....

Salesforce

Reusable Related List using LWC in Salesforce

Sample code: HTML: <template> <lightning-card title={titleWithCount} icon-name="standard:record"> <lightning-button label="New" slot="actions" onclick={createNew}></lightning-button> <div slot="footer"> <div if:true={countBool}> <lightning-button label="View All" onclick={navigateToRelatedList}></lightning-button> </div> </div> <div class="slds-m-around_medium"> <div if:true={listRecords}> <template for:each={listRecords} for:item="rec"> <div key={rec.Id} ....

Salesforce

How to iterate over Records returned By Wire Service in LWC?

Sample Code: HTML: <template> <div> <lightning-datatable key-field="Id" data={accountsWithIndustry} columns={columns} hide-checkbox-column="true" show-row-number-column="true"> </lightning-datatable> </div> <div> <lightning-datatable key-field="Id" data={accountsWithoutIndustry} columns={columns} hide-checkbox-column="true" show-row-number-column="true"> </lightning-datatable> </div> </template> JavaScript: import { LightningElement, wire, track } ....

Salesforce

Popup using Lightning Web Component in Salesforce

For PopUp using LWC, check the following code. HTML: <template> <lightning-button onclick={showPopUp} label="Show PopUp"></lightning-button> <div style="height: 640px;" if:true={checkBool}> <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open"> <div class="slds-modal__container"> <header class="slds-modal__header"> <button ....