Skip to content

Instantly share code, notes, and snippets.

@anilsomasundaran
Last active March 23, 2019 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anilsomasundaran/97275cf8042d1e23c238235294567555 to your computer and use it in GitHub Desktop.
Save anilsomasundaran/97275cf8042d1e23c238235294567555 to your computer and use it in GitHub Desktop.
<template>
<lightning-card title="My Available Contacts" variant="narrow" icon-name="standard:custom57":wq>
<div class="slds-m-around_medium">
<template for:each={contacts} for:item='contact'>
<lightning-layout vertical-align="center" key={contact.Id} class="slds-m-vertical_medium">
<lightning-layout-item>
<img src={contact.Picture__c} alt="Profile photo" />
</lightning-layout-item>
<lightning-layout-item padding="around-small">
<p>{contact.Name}</p>
<p>{contact.Title}</p>
<p>
<lightning-formatted-phone value={contact.Phone}></lightning-formatted-phone>
</p>
</lightning-layout-item>
</lightning-layout>
</template>
</div>
<div slot="footer">
<h6>Visit My <a href="http://techevangel.com">Blog</a> for more details...</h6>
</div>
</lightning-card>
</template>
import { LightningElement } from 'lwc';
export default class ContactList extends LightningElement {
contacts = [
{
Id: '003171931112854375',
Name: 'Amy Taylor',
Title: 'VP of Engineering',
Phone: '6172559632',
Picture__c:
'https://s3-us-west-1.amazonaws.com/sfdc-demo/people/amy_taylor.jpg'
},
{
Id: '003192301009134555',
Name: 'Michael Jones',
Title: 'VP of Sales',
Phone: '6172551122',
Picture__c:
'https://s3-us-west-1.amazonaws.com/sfdc-demo/people/michael_jones.jpg'
},
{
Id: '003848991274589432',
Name: 'Jennifer Wu',
Title: 'CEO',
Phone: '6172558877',
Picture__c:
'https://s3-us-west-1.amazonaws.com/sfdc-demo/people/jennifer_wu.jpg'
}
];
}
img {
width: 70px;
height: 70px;
border-radius: 50%;
}
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="contactList">
<apiVersion>45.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment