Questions tagged [lightning-web-components]

This tag is for questions related to JavaScript, CSS, or Markup when used in the Lightning Web Component (LWC) programming model, or for questions of interoperability between LWC and the original Aura-based lightning components.

Filter by
Sorted by
Tagged with
46
votes
7answers
20k views

Target inner elements of standard Lightning Web Components with CSS

Say we have a LWC with the following template in a component named example: <template> <lightning-textarea class="test"></lightning-textarea> </template> And some css to ...
35
votes
5answers
22k views

Expression Functions for Lightning Web Components

How can expression functions similar to Visualforce and Lightning Aura Components be achieved within lightning web components? For example, <template if:true={index % 5 == 0}><br></...
35
votes
1answer
5k views

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?
33
votes
6answers
15k views

Uncaught TypeError: 'set' on proxy: trap returned falsish for property Name

Am not doing anything fancy, just trying to update a field on Contact in JS of LWC but getting this exception. Uncaught TypeError: 'set' on proxy: trap returned falsish for property 'Name' throws at ...
32
votes
3answers
4k views

How to turn boxcarring OFF for LWC imperative apex method calls?

We are running in a blocking performance issue on a page that we built using Lightning Web Components. Our page has many LWC components, each calling various apex methods via an imperative method ...
29
votes
3answers
11k views

Lightning Web Components - Benefits and Support

Salesforce announced Lightning Web Components in Dec. 2018. In comparison to the existing Aura Framework: What are the benefits of using Lightning Web Components? / How much faster are they? Where ...
28
votes
5answers
21k views

Dynamic component creation in Lightning Web Components

Is there any way to create and add lightning web components dynamically in the component tree ? I mean the equivalent one in Aura is $A.createComponent(). The usual Web Components can be dynamically ...
26
votes
3answers
20k views

LWC as QuickAction in Salesforce

I have made a quick action in lightning web component and want ot make that compponent available for quick action. I havenot found any guide or documentation regarding this. Can you please suggest on ...
24
votes
5answers
33k views

Force refresh view in LWC

In Aura, we can do $A.get('e.force:refreshView').fire(); to cause standard components to update. How can we do an equivalent in LWC because sfdx refuses to publish .js code with $A in it saying ...
20
votes
2answers
5k views

Not able to render dynamic Lightning Web Component

I am refering Play Ground to render dynamic component in LWC. But it is giving error createElement is not defined. Have any one idea how to render dynamic component. Alternative of createComponent ...
17
votes
1answer
1k views

Array.find and Array.findIndex has worst performance in LWC Lightning Locker

For the component chain like below: <container> <parent> <child> <grand-child> Pass an Array from container to all the way down to grand-child. This is ...
16
votes
2answers
31k views

How do you define an element with an ID attribute using LWC?

I'd like to be able to link to certain portions of my page using URL fragments, eg: <h3 id="overview">Overview</h3> ... <a href="#overview">Go to Overview</a> Unfortunately ...
16
votes
2answers
13k views

async/await functions in LWC

Assume I have an LWC component and Apex Aura controller: /* AccountController.cls */ public with sharing class AccountController { @AuraEnabled public static List<Account> getAll() { ...
15
votes
2answers
13k views

Can't get refreshApex() to work in lwc

I'm not able to get refreshApex() working in an lwc. I've read the docs here -- scroll to the bottom. Here are the key elements of the js file: import { LightningElement, track, api, wire } from 'lwc'...
15
votes
2answers
3k views

CSS animation in LWC not working

I'm unable to get a simple css fade-in-out text animation to work in LWC. The text displays on the page okay, but it does not fade in/out like expected. It seems as though the keyframes are getting ...
15
votes
1answer
6k views

Chain wire methods together in Lightning Web Components

According to the documentation here in order to retrieve a list of picklist values for an object we need to pass in a Record Type Id which can be retrieved using the getObjectInfo method. The issue ...
15
votes
3answers
704 views

Not being able to reference packaged custom LWCs from other LWCs outside the package

This restriction referenced from Distribute Components on AppExchange: A custom Lightning web component can’t access a Lightning web component or module in a custom namespace. It can access ...
14
votes
2answers
9k views

Using unescape HTML in lightning web component

I am currently having an issue to show the content fetched from salesforce database to UI. The data is stored in HTML form and I want it to show on UI using LWC without escaping HTML. Previously we ...
14
votes
5answers
16k views

Add Lightning Web Component to Lightning Tab

I am trying to figure out how to add a Lightning Web Component to a Lightning tab. I have it on the Home Page, but I would like it to be on its own tab. I feel like there should be an option to ...
14
votes
5answers
5k views

What is involved in moving over to Lightning Web Components?

I read: Aura Components, leveraging its own component model, templates, and modular development programming model. Lightning Web Components, built on top of the web standards breakthroughs of the ...
14
votes
3answers
27k views

Track Input value in LWC

What I'm trying to bind a controller variable with lightning-input's value. For instance myVar So far Following all examples and documentation of LWC I'm able to do so by using the onchange method ...
14
votes
2answers
4k views

Feasibility to import entire LWC classes to access @api methods

I'm looking to modularize my LWC without having to embed them in the template. Ideally, would this kind of pattern be feasible? I'm not sure if it's my lack of ES6 knowledge (modules) or that LWC ...
14
votes
1answer
3k views

Lightning Web Components Open Source with Lightning Design System (lwc with slds)

I am trying to local development with Lightning Web Component. The https://lwc.dev works good and I want to also add the Lightning Design System style but I am getting errors. I have installed the ...
14
votes
2answers
13k views

How to target LWC by name attribute?

During a submit I'd like to intercept the event and run some custom validation on the input values. Here is a simplified template of what I'd like to do: <template> <lightning-input type="...
14
votes
3answers
7k views

LWC Handling Multiple Dependents @Wire methods

How we handle dependent wire in LWC? For example : @wire(getObjectInfo, { objectApiName: OPP_OBJECT }) objectInfo; @wire(getPicklistValues, { recordTypeId: '$objectInfo.data....
13
votes
5answers
13k views

Lightning Web Components - Not available in app builder

I'm developing a lightning web component with org based development and I'm finding that the component isn't available in the app builder, despite (as far as I can tell) making it available in the ...
13
votes
3answers
23k views

Lightning Web Component for table rows and cells

I'm trying to build a LWC that renders a complex table-based UI. It needs to have distinct rows and columns with dynamically-determined colspans - a real table. It's for assigning lodging, and each ...
13
votes
2answers
23k views

Javscript onload in LWC

i have a requirement to call a javascript method on load of the template. is there any way to do that in LWC?
13
votes
1answer
10k views

Log to console in a Lightning Web Component

I am attempting to write a Lightning Web Component, but continually run into errors in my Javascript that I can't debug. I've been trying to log my error but when I put console.log() anywhere in the ...
13
votes
3answers
8k views

Is it possible to navigate to a Visualforce page from an LWC with parameters and community compatible

The LWC framework includes the NavigationMixin.Navigate functionality that can be used to obtain URLs or perform navigation to generated URLs. This supports a number of different page types, as ...
13
votes
1answer
712 views

LWC setting properties in connectedCallback()

This blog is talking about things we can do with lwc connectedCallback method. It seems to contradict itself with a certain point so I am trying to make sure. They say that we can set property values ...
13
votes
1answer
2k views

Canvas App (or equivalent) for Lightning Web Components

We are currently using the force:canvasApp lightning component to embed an external site securely into Salesforce. The Spring '19 release is introducing Lightning Web Components as the future of ...
12
votes
3answers
4k views

Where is the Lightning Web Component developer guide?

Initially Lightning Web Components was announced with a blog post. There is also a trailhead project and sample apps. But I don't see anything in the developer documentation portal if I just want ...
12
votes
1answer
9k views

how to pass parameter to apex method which is called imperatively from lightning web component

I'm working on one LWC and facing issue while passing parameters to an apex method which I am calling imperatively on selection of a record in datatable. I'm able to get selected recordid in JS ...
12
votes
2answers
5k views

Use of Javascript Frameworks in Lightning Web Component

Is there any documentation available for recommended JavaScript Frameworks (Angular JS, React JS, etc.), which can work well with Lightning Web Component? Most of the places, I found that it supports ...
12
votes
1answer
9k views

appendChild to non empty div in lightning web component

I am using a thrid party library to render certain elements in a 'container', and as per the documentation on lwc directives, I understand that I have to add a directive to specificaly indicate that ...
12
votes
2answers
973 views

Testing LWC with multiple @wire getRecord calls with Jest

I thought this would be straight-forward, but it turns out to be a complete nightmare. Found no help on google, in the lwc-recipes or documentation. Here's my issue: I have a LWC that makes multiple ...
12
votes
1answer
605 views

Will LightningComponentBundle and LightningComponentResource mapped into the database like AuraDefinitionBundle and AuraDefinition

I'm checking this on a Spring'19 v45 Sandbox in Execute Anonymous: [ select Id from AuraDefinitionBundle ] // ==> works fine! [ select Id from AuraDefinition ] // ==> flawless!...
11
votes
1answer
9k views

LWC Navigation: “this[f.NavigationMixin.Navigate] is not a function”

When attempting to use the Lightning navigation service in my component's base class (.js), I get the following error when functionally testing in the UI: this[f.NavigationMixin.Navigate] is not a ...
11
votes
3answers
2k views

Will Lightning Web Components have retrocompatibility?

I've just read here that Salesforce decide to change the framework used for Lightning Component. In according with this article, it seems very powerful under some aspects. In your opinion, the actual ...
11
votes
2answers
18k views

How do I invoke a value change handler in LWC?

Is there a way in LWC to declare an attribute value change handler like there was in Aura? My use case is that I have a pager component which has 2 @api properties. When either of the @api values ...
11
votes
2answers
21k views

Set CSS class dynamically in Lightning web component

How would I translate that from Aura to LWC? <aura:iteration items="{!v.contacts}" var="contact"> <div class="{!contact.isActive ? 'slds-tabs--path dimmed' : 'slds-tabs--path'}">...<...
11
votes
1answer
7k views

Can we access the key attribute when handling an event from a foreach template

// TEMPLATE <template for:each={itemList} for:item="item"> <li key={item} onclick={handleItemClicked}>{item}</li> </template> // JS itemList = ['A','B','C']; ...
11
votes
3answers
5k views

Modern JavaScript Frameworks (Angular Js, React JS ) within LWC

As documented on the below link, https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.get_started_supported_javascript Lightning Web Components Javascript support includes :...
11
votes
1answer
708 views

LWC Playground: Save option removed?

Did Salesforce get rid of the Save button in Lightning Web Component Playground? I can't find anything in the release notes about this. Pretty unfortunate if this is permanent. Saved Playground ...
11
votes
2answers
3k views

How can we expose inherited properties from a super component’s class in a lightning Web Components through targetConfigs (design attributes)

Is there currently a way of exposing properties inherited from super classes in Lightning Web Components, as design attributes (targetConfigs), or is this a gap? I’m inheriting base classes which ...
11
votes
1answer
3k views

Why it is forbidden to import several Apex Methods at once in LWC module?

I have Apex Controller Class, say, LWCController and several methods inside of it, let's say Method1, Method2, Method3, Method4, Method5. Documentation says that to Use default import syntax to ...
11
votes
4answers
4k views

Design tokens doesn't work in LWC?

I'm trying to use Lightning Tokens as described in Developer Guide, but unfortunately, it can't resolve the reference. I tried wrapping LWC component with Aura component it. Using tokens works in ...
10
votes
4answers
8k views

How to convey LWC's complex Reactive property back to markup?

From SF docs: There are some limitations on the depth of changes tracked for rerendering in reactive properties. The tracking depth depends on the type of the reactive property. Lightning ...
10
votes
4answers
1k views

Is it possible to make one css or js in common to all my Lightning web components?

Here is my situation, I have two (and soon more) LWC, inside each component, I have the classic : html, css, js and xml. In my case, the first LWC is having many css properties in common with the ...

1
2 3 4 5
96