What are Lightning Web Components
Salesforce has just announced a new feature, Lightning Web Components. What is this? What does it have to do with Lightning Components and the Lightning Component Framework?
lightning-web-components
add a comment |
Salesforce has just announced a new feature, Lightning Web Components. What is this? What does it have to do with Lightning Components and the Lightning Component Framework?
lightning-web-components
add a comment |
Salesforce has just announced a new feature, Lightning Web Components. What is this? What does it have to do with Lightning Components and the Lightning Component Framework?
lightning-web-components
Salesforce has just announced a new feature, Lightning Web Components. What is this? What does it have to do with Lightning Components and the Lightning Component Framework?
lightning-web-components
lightning-web-components
edited Dec 22 '18 at 21:54
pchittum
asked Dec 13 '18 at 13:24
pchittumpchittum
14.9k33783
14.9k33783
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Lightning web components (LWC) are a new programming model for the Lightning Component Framework that is slated to be released in the Spring 19 release. This programming model was architected with three principles in mind.
- Align with modern web standards
- Interoperability with the original Aura-based Lightning component development model
- Performance
Standards
LWC is compliant with most ES2015 (aka ES6) and later standards that have seen good adoption across modern browsers. JavaScript APIs such as Class
, Module
, Shadow DOM, CustomComponent
, decorators, mix-ins, and many more figure heavily into the architecture, as do modern HTML and CSS features. This brings a great deal of benefit for the developer. First, the main body of knowledge and skill required is modern JavaScript. It also brings a much simplified component bundle structure and developer experience where a given component is comprised solely of an HTML template, a JavaScript module, and a CSS file (where required).
Here's a screen shot of the component bundle (no CSS) in a project in VisualStudio Code.
Here's an example of the code from a Lightning web component:
HTML Template:
<template>
<lightning-card title="RecordEditFormDynamicContact" icon-name="standard:contact">
<div class="slds-m-around_medium">
<lightning-record-edit-form
object-api-name="objectApiName"
record-id="recordId">
<lightning-messages></lightning-messages>
<lightning-input-field field-name="Name"></lightning-input-field>
<lightning-input-field field-name="Title"></lightning-input-field>
<lightning-input-field field-name="Phone"></lightning-input-field>
<lightning-input-field field-name="Email"></lightning-input-field>
<div class="slds-m-top_medium">
<lightning-button variant="brand" type="submit" name="save" label="Save"></lightning-button>
</div>
</lightning-record-edit-form>
</div>
</lightning-card>
</template>
JS Module:
import { LightningElement, api } from 'lwc';
export default class RecordEditFormDynamicContact extends LightningElement {
@api recordId;
@api objectApiName;
}
While this is a very simple component that simply surfaces two attributes (the @api
decorated properties), you can already see how the JS code reflects modern standards in the import
statement for including other JS modules, the export
of the class of this module, the use of the class
and extends
syntax, and the use of JavaScript decorators.
Interoperability
In designing a new programming model for the Lightning Component framework, interoperability with existing Aura-based components is a must. With the GA of LWC, any component built using the LWC programming model can be used in an existing Lightning Component page. To prove this model, Salesforce have used LWC to build Lightning base components for the last year. Any of your existing Lightning Web Components that use a lightning:xxx
base component is already using LWC.
Performance
Salesforce has yet to publish any benchmarks or performance data related to Lightning Web Components. But look for upcoming blog posts from the LWC engineering team.
Anecdotally, as more and more of the Lightning Experience UI has become composed of LWC over the past year, many customers have reflected back to Salesforce an experience of better performance.
Learn More
For more details about LWC, please see the introductory blog post on the Salesforce developer blog which has many links to documentation, sample code and applications, and of course, Trailhead.
Aagh! I don't want to read a whole blog, I just want to do something!
No problem. Just go to this quick start project on Trailhead and get the badge.
This looks so amazing, I wanna try it out. I have Spring 19 pre-release org , can I try it out there?
– Pranay Jaiswal
Dec 13 '18 at 14:50
1
Yes. The quick start is the best way to walk through. I'll add a direct link above for you or anyone who just wants to get on with doing something.
– pchittum
Dec 13 '18 at 15:03
Is there any way to view the LWCs in Developer Console? Or do we have to exclusively modify them in SFDX?
– user62883
Dec 14 '18 at 11:38
1
@SCGB Support for LWC was not implemented in developer console. This would probably stand as its own question. Do you want to ask it?
– pchittum
Dec 14 '18 at 13:18
LWC are not part of the aura framework, correct?
– Tyler Zika
Dec 22 '18 at 0:24
|
show 2 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "459"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f242469%2fwhat-are-lightning-web-components%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Lightning web components (LWC) are a new programming model for the Lightning Component Framework that is slated to be released in the Spring 19 release. This programming model was architected with three principles in mind.
- Align with modern web standards
- Interoperability with the original Aura-based Lightning component development model
- Performance
Standards
LWC is compliant with most ES2015 (aka ES6) and later standards that have seen good adoption across modern browsers. JavaScript APIs such as Class
, Module
, Shadow DOM, CustomComponent
, decorators, mix-ins, and many more figure heavily into the architecture, as do modern HTML and CSS features. This brings a great deal of benefit for the developer. First, the main body of knowledge and skill required is modern JavaScript. It also brings a much simplified component bundle structure and developer experience where a given component is comprised solely of an HTML template, a JavaScript module, and a CSS file (where required).
Here's a screen shot of the component bundle (no CSS) in a project in VisualStudio Code.
Here's an example of the code from a Lightning web component:
HTML Template:
<template>
<lightning-card title="RecordEditFormDynamicContact" icon-name="standard:contact">
<div class="slds-m-around_medium">
<lightning-record-edit-form
object-api-name="objectApiName"
record-id="recordId">
<lightning-messages></lightning-messages>
<lightning-input-field field-name="Name"></lightning-input-field>
<lightning-input-field field-name="Title"></lightning-input-field>
<lightning-input-field field-name="Phone"></lightning-input-field>
<lightning-input-field field-name="Email"></lightning-input-field>
<div class="slds-m-top_medium">
<lightning-button variant="brand" type="submit" name="save" label="Save"></lightning-button>
</div>
</lightning-record-edit-form>
</div>
</lightning-card>
</template>
JS Module:
import { LightningElement, api } from 'lwc';
export default class RecordEditFormDynamicContact extends LightningElement {
@api recordId;
@api objectApiName;
}
While this is a very simple component that simply surfaces two attributes (the @api
decorated properties), you can already see how the JS code reflects modern standards in the import
statement for including other JS modules, the export
of the class of this module, the use of the class
and extends
syntax, and the use of JavaScript decorators.
Interoperability
In designing a new programming model for the Lightning Component framework, interoperability with existing Aura-based components is a must. With the GA of LWC, any component built using the LWC programming model can be used in an existing Lightning Component page. To prove this model, Salesforce have used LWC to build Lightning base components for the last year. Any of your existing Lightning Web Components that use a lightning:xxx
base component is already using LWC.
Performance
Salesforce has yet to publish any benchmarks or performance data related to Lightning Web Components. But look for upcoming blog posts from the LWC engineering team.
Anecdotally, as more and more of the Lightning Experience UI has become composed of LWC over the past year, many customers have reflected back to Salesforce an experience of better performance.
Learn More
For more details about LWC, please see the introductory blog post on the Salesforce developer blog which has many links to documentation, sample code and applications, and of course, Trailhead.
Aagh! I don't want to read a whole blog, I just want to do something!
No problem. Just go to this quick start project on Trailhead and get the badge.
This looks so amazing, I wanna try it out. I have Spring 19 pre-release org , can I try it out there?
– Pranay Jaiswal
Dec 13 '18 at 14:50
1
Yes. The quick start is the best way to walk through. I'll add a direct link above for you or anyone who just wants to get on with doing something.
– pchittum
Dec 13 '18 at 15:03
Is there any way to view the LWCs in Developer Console? Or do we have to exclusively modify them in SFDX?
– user62883
Dec 14 '18 at 11:38
1
@SCGB Support for LWC was not implemented in developer console. This would probably stand as its own question. Do you want to ask it?
– pchittum
Dec 14 '18 at 13:18
LWC are not part of the aura framework, correct?
– Tyler Zika
Dec 22 '18 at 0:24
|
show 2 more comments
Lightning web components (LWC) are a new programming model for the Lightning Component Framework that is slated to be released in the Spring 19 release. This programming model was architected with three principles in mind.
- Align with modern web standards
- Interoperability with the original Aura-based Lightning component development model
- Performance
Standards
LWC is compliant with most ES2015 (aka ES6) and later standards that have seen good adoption across modern browsers. JavaScript APIs such as Class
, Module
, Shadow DOM, CustomComponent
, decorators, mix-ins, and many more figure heavily into the architecture, as do modern HTML and CSS features. This brings a great deal of benefit for the developer. First, the main body of knowledge and skill required is modern JavaScript. It also brings a much simplified component bundle structure and developer experience where a given component is comprised solely of an HTML template, a JavaScript module, and a CSS file (where required).
Here's a screen shot of the component bundle (no CSS) in a project in VisualStudio Code.
Here's an example of the code from a Lightning web component:
HTML Template:
<template>
<lightning-card title="RecordEditFormDynamicContact" icon-name="standard:contact">
<div class="slds-m-around_medium">
<lightning-record-edit-form
object-api-name="objectApiName"
record-id="recordId">
<lightning-messages></lightning-messages>
<lightning-input-field field-name="Name"></lightning-input-field>
<lightning-input-field field-name="Title"></lightning-input-field>
<lightning-input-field field-name="Phone"></lightning-input-field>
<lightning-input-field field-name="Email"></lightning-input-field>
<div class="slds-m-top_medium">
<lightning-button variant="brand" type="submit" name="save" label="Save"></lightning-button>
</div>
</lightning-record-edit-form>
</div>
</lightning-card>
</template>
JS Module:
import { LightningElement, api } from 'lwc';
export default class RecordEditFormDynamicContact extends LightningElement {
@api recordId;
@api objectApiName;
}
While this is a very simple component that simply surfaces two attributes (the @api
decorated properties), you can already see how the JS code reflects modern standards in the import
statement for including other JS modules, the export
of the class of this module, the use of the class
and extends
syntax, and the use of JavaScript decorators.
Interoperability
In designing a new programming model for the Lightning Component framework, interoperability with existing Aura-based components is a must. With the GA of LWC, any component built using the LWC programming model can be used in an existing Lightning Component page. To prove this model, Salesforce have used LWC to build Lightning base components for the last year. Any of your existing Lightning Web Components that use a lightning:xxx
base component is already using LWC.
Performance
Salesforce has yet to publish any benchmarks or performance data related to Lightning Web Components. But look for upcoming blog posts from the LWC engineering team.
Anecdotally, as more and more of the Lightning Experience UI has become composed of LWC over the past year, many customers have reflected back to Salesforce an experience of better performance.
Learn More
For more details about LWC, please see the introductory blog post on the Salesforce developer blog which has many links to documentation, sample code and applications, and of course, Trailhead.
Aagh! I don't want to read a whole blog, I just want to do something!
No problem. Just go to this quick start project on Trailhead and get the badge.
This looks so amazing, I wanna try it out. I have Spring 19 pre-release org , can I try it out there?
– Pranay Jaiswal
Dec 13 '18 at 14:50
1
Yes. The quick start is the best way to walk through. I'll add a direct link above for you or anyone who just wants to get on with doing something.
– pchittum
Dec 13 '18 at 15:03
Is there any way to view the LWCs in Developer Console? Or do we have to exclusively modify them in SFDX?
– user62883
Dec 14 '18 at 11:38
1
@SCGB Support for LWC was not implemented in developer console. This would probably stand as its own question. Do you want to ask it?
– pchittum
Dec 14 '18 at 13:18
LWC are not part of the aura framework, correct?
– Tyler Zika
Dec 22 '18 at 0:24
|
show 2 more comments
Lightning web components (LWC) are a new programming model for the Lightning Component Framework that is slated to be released in the Spring 19 release. This programming model was architected with three principles in mind.
- Align with modern web standards
- Interoperability with the original Aura-based Lightning component development model
- Performance
Standards
LWC is compliant with most ES2015 (aka ES6) and later standards that have seen good adoption across modern browsers. JavaScript APIs such as Class
, Module
, Shadow DOM, CustomComponent
, decorators, mix-ins, and many more figure heavily into the architecture, as do modern HTML and CSS features. This brings a great deal of benefit for the developer. First, the main body of knowledge and skill required is modern JavaScript. It also brings a much simplified component bundle structure and developer experience where a given component is comprised solely of an HTML template, a JavaScript module, and a CSS file (where required).
Here's a screen shot of the component bundle (no CSS) in a project in VisualStudio Code.
Here's an example of the code from a Lightning web component:
HTML Template:
<template>
<lightning-card title="RecordEditFormDynamicContact" icon-name="standard:contact">
<div class="slds-m-around_medium">
<lightning-record-edit-form
object-api-name="objectApiName"
record-id="recordId">
<lightning-messages></lightning-messages>
<lightning-input-field field-name="Name"></lightning-input-field>
<lightning-input-field field-name="Title"></lightning-input-field>
<lightning-input-field field-name="Phone"></lightning-input-field>
<lightning-input-field field-name="Email"></lightning-input-field>
<div class="slds-m-top_medium">
<lightning-button variant="brand" type="submit" name="save" label="Save"></lightning-button>
</div>
</lightning-record-edit-form>
</div>
</lightning-card>
</template>
JS Module:
import { LightningElement, api } from 'lwc';
export default class RecordEditFormDynamicContact extends LightningElement {
@api recordId;
@api objectApiName;
}
While this is a very simple component that simply surfaces two attributes (the @api
decorated properties), you can already see how the JS code reflects modern standards in the import
statement for including other JS modules, the export
of the class of this module, the use of the class
and extends
syntax, and the use of JavaScript decorators.
Interoperability
In designing a new programming model for the Lightning Component framework, interoperability with existing Aura-based components is a must. With the GA of LWC, any component built using the LWC programming model can be used in an existing Lightning Component page. To prove this model, Salesforce have used LWC to build Lightning base components for the last year. Any of your existing Lightning Web Components that use a lightning:xxx
base component is already using LWC.
Performance
Salesforce has yet to publish any benchmarks or performance data related to Lightning Web Components. But look for upcoming blog posts from the LWC engineering team.
Anecdotally, as more and more of the Lightning Experience UI has become composed of LWC over the past year, many customers have reflected back to Salesforce an experience of better performance.
Learn More
For more details about LWC, please see the introductory blog post on the Salesforce developer blog which has many links to documentation, sample code and applications, and of course, Trailhead.
Aagh! I don't want to read a whole blog, I just want to do something!
No problem. Just go to this quick start project on Trailhead and get the badge.
Lightning web components (LWC) are a new programming model for the Lightning Component Framework that is slated to be released in the Spring 19 release. This programming model was architected with three principles in mind.
- Align with modern web standards
- Interoperability with the original Aura-based Lightning component development model
- Performance
Standards
LWC is compliant with most ES2015 (aka ES6) and later standards that have seen good adoption across modern browsers. JavaScript APIs such as Class
, Module
, Shadow DOM, CustomComponent
, decorators, mix-ins, and many more figure heavily into the architecture, as do modern HTML and CSS features. This brings a great deal of benefit for the developer. First, the main body of knowledge and skill required is modern JavaScript. It also brings a much simplified component bundle structure and developer experience where a given component is comprised solely of an HTML template, a JavaScript module, and a CSS file (where required).
Here's a screen shot of the component bundle (no CSS) in a project in VisualStudio Code.
Here's an example of the code from a Lightning web component:
HTML Template:
<template>
<lightning-card title="RecordEditFormDynamicContact" icon-name="standard:contact">
<div class="slds-m-around_medium">
<lightning-record-edit-form
object-api-name="objectApiName"
record-id="recordId">
<lightning-messages></lightning-messages>
<lightning-input-field field-name="Name"></lightning-input-field>
<lightning-input-field field-name="Title"></lightning-input-field>
<lightning-input-field field-name="Phone"></lightning-input-field>
<lightning-input-field field-name="Email"></lightning-input-field>
<div class="slds-m-top_medium">
<lightning-button variant="brand" type="submit" name="save" label="Save"></lightning-button>
</div>
</lightning-record-edit-form>
</div>
</lightning-card>
</template>
JS Module:
import { LightningElement, api } from 'lwc';
export default class RecordEditFormDynamicContact extends LightningElement {
@api recordId;
@api objectApiName;
}
While this is a very simple component that simply surfaces two attributes (the @api
decorated properties), you can already see how the JS code reflects modern standards in the import
statement for including other JS modules, the export
of the class of this module, the use of the class
and extends
syntax, and the use of JavaScript decorators.
Interoperability
In designing a new programming model for the Lightning Component framework, interoperability with existing Aura-based components is a must. With the GA of LWC, any component built using the LWC programming model can be used in an existing Lightning Component page. To prove this model, Salesforce have used LWC to build Lightning base components for the last year. Any of your existing Lightning Web Components that use a lightning:xxx
base component is already using LWC.
Performance
Salesforce has yet to publish any benchmarks or performance data related to Lightning Web Components. But look for upcoming blog posts from the LWC engineering team.
Anecdotally, as more and more of the Lightning Experience UI has become composed of LWC over the past year, many customers have reflected back to Salesforce an experience of better performance.
Learn More
For more details about LWC, please see the introductory blog post on the Salesforce developer blog which has many links to documentation, sample code and applications, and of course, Trailhead.
Aagh! I don't want to read a whole blog, I just want to do something!
No problem. Just go to this quick start project on Trailhead and get the badge.
edited Dec 13 '18 at 15:04
community wiki
4 revs
pchittum
This looks so amazing, I wanna try it out. I have Spring 19 pre-release org , can I try it out there?
– Pranay Jaiswal
Dec 13 '18 at 14:50
1
Yes. The quick start is the best way to walk through. I'll add a direct link above for you or anyone who just wants to get on with doing something.
– pchittum
Dec 13 '18 at 15:03
Is there any way to view the LWCs in Developer Console? Or do we have to exclusively modify them in SFDX?
– user62883
Dec 14 '18 at 11:38
1
@SCGB Support for LWC was not implemented in developer console. This would probably stand as its own question. Do you want to ask it?
– pchittum
Dec 14 '18 at 13:18
LWC are not part of the aura framework, correct?
– Tyler Zika
Dec 22 '18 at 0:24
|
show 2 more comments
This looks so amazing, I wanna try it out. I have Spring 19 pre-release org , can I try it out there?
– Pranay Jaiswal
Dec 13 '18 at 14:50
1
Yes. The quick start is the best way to walk through. I'll add a direct link above for you or anyone who just wants to get on with doing something.
– pchittum
Dec 13 '18 at 15:03
Is there any way to view the LWCs in Developer Console? Or do we have to exclusively modify them in SFDX?
– user62883
Dec 14 '18 at 11:38
1
@SCGB Support for LWC was not implemented in developer console. This would probably stand as its own question. Do you want to ask it?
– pchittum
Dec 14 '18 at 13:18
LWC are not part of the aura framework, correct?
– Tyler Zika
Dec 22 '18 at 0:24
This looks so amazing, I wanna try it out. I have Spring 19 pre-release org , can I try it out there?
– Pranay Jaiswal
Dec 13 '18 at 14:50
This looks so amazing, I wanna try it out. I have Spring 19 pre-release org , can I try it out there?
– Pranay Jaiswal
Dec 13 '18 at 14:50
1
1
Yes. The quick start is the best way to walk through. I'll add a direct link above for you or anyone who just wants to get on with doing something.
– pchittum
Dec 13 '18 at 15:03
Yes. The quick start is the best way to walk through. I'll add a direct link above for you or anyone who just wants to get on with doing something.
– pchittum
Dec 13 '18 at 15:03
Is there any way to view the LWCs in Developer Console? Or do we have to exclusively modify them in SFDX?
– user62883
Dec 14 '18 at 11:38
Is there any way to view the LWCs in Developer Console? Or do we have to exclusively modify them in SFDX?
– user62883
Dec 14 '18 at 11:38
1
1
@SCGB Support for LWC was not implemented in developer console. This would probably stand as its own question. Do you want to ask it?
– pchittum
Dec 14 '18 at 13:18
@SCGB Support for LWC was not implemented in developer console. This would probably stand as its own question. Do you want to ask it?
– pchittum
Dec 14 '18 at 13:18
LWC are not part of the aura framework, correct?
– Tyler Zika
Dec 22 '18 at 0:24
LWC are not part of the aura framework, correct?
– Tyler Zika
Dec 22 '18 at 0:24
|
show 2 more comments
Thanks for contributing an answer to Salesforce Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f242469%2fwhat-are-lightning-web-components%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown