What's the deal with Deno? We talk with a major contributor to find out. Listen now.

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
2
votes
3answers
6k views

Changing colors of lightning-button

How can I change the colors of lightning-button? I tried doing this in my css: .my-button { background-color: #14a6bc; color: #ffffff; } and applying that class to my <lightning-button&...
37
votes
7answers
14k 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 ...
25
votes
4answers
10k 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 ...
34
votes
4answers
15k 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></...
5
votes
1answer
8k views

How to use custom LWC lightning component in lightning-datatable

If we want to have custom lightning component in LWC lightning-datatable, for example Upload file for each of the records, how can we do that?
20
votes
2answers
4k 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 ...
4
votes
2answers
14k views

working with the refreshApex feature in LWC

Okay, i'm looking to see if I can get some help in understanding the documentation as laid out here: https://developer.salesforce.com/docs/component-library/documentation/lwc/...
10
votes
2answers
4k 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 ...
8
votes
4answers
5k 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 ...
20
votes
5answers
20k 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 ...
28
votes
5answers
16k 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 ...
2
votes
2answers
621 views

Is there a way to load every label data and every SObject description data in Lightning Web Component using only Javascript without any Apex?

Is there a way to load every label data and every SObject description data using only Javascript without any Apex Server-side code? How do I import * from @salesforce/schema or @salesforce/label? I ...
28
votes
3answers
3k 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 ...
12
votes
3answers
16k 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 ...
6
votes
1answer
4k views

Import ES modules in LWC

I have a JS library that provides a module. I am importing it in my LWC like this example here: https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.create_third_party_library ...
7
votes
2answers
5k views

LWC: How do I display “out of box” object hover?

When you hover over an Account name link on standard views, a popup with the Compact Layout shows the details of that record. Is it possible to do this using Lightning Web Components? Perhaps using ...
6
votes
1answer
7k views

Array.push() won't update Lightning Web Component View [duplicate]

We are migrating over to Lightning Web Components in the last couple of weeks now and we had some struggles with the arrays in Javascript. On a trackable array, when I call push in a wiredMethod, ...
10
votes
1answer
385 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 ...
4
votes
1answer
2k views

Lightning Web Component: how can I use Get Child Records UI API?

According to documentation, Lightning Data Services is built on top of UI API. So my question is: How I do to user Get Child Records UI API?
2
votes
2answers
338 views

Can we increase the lightning-accordion-section label font size

Is it possible to change the lightning-accordion-section label font size, I tried by adding class="slds-text-heading_medium" It print like below Play Ground Expecting to increase the Font Size and ...
9
votes
2answers
2k views

How to refresh wired service getRecord manually?

Please note that this is not duplicate of LWC Force Refresh Wire getRecord - this question and answer specifically speaks about changes in front-end/UI and capturing that in front-end BUT LDS cannot ...
13
votes
2answers
8k 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() { ...
16
votes
1answer
527 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 ...
10
votes
2answers
14k 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 ...
7
votes
3answers
4k views

Google Recaptcha V3 Implementation in Lightning Web Component

I have requirement to add Recaptcha in Lightning Web Component component. I have used V3 of google recaptacha. I have added https://www.google.com/recaptcha/api.js url in static resource and ...
7
votes
3answers
12k views

How do I pass a SObject record from LWC to a custom Apex method to persist data?

Disclaimer: My answer to this question does not deal with a real business use case scenario. The approach mentioned in my answer was found to be working while going through this question. The answer ...
21
votes
5answers
13k 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 ...
7
votes
2answers
11k views

How to get an LWC component on a record page to refresh when that page is updated

This is my version of Dana's question: I have an LWC component that is dropped into a record page (it accepts the recordId property and this is automatically populated by the flexipage infrastructure)...
4
votes
3answers
2k views

LWC: how to dynamically get translated value from Label

In Aura we used to do this: let labelName = 'mylabel'; $A.getReference("$Label.c."+ labelName); In LWC $A is not accessible anymore. Following the documentation I can only see a way to get access ...
5
votes
2answers
3k views

Lightning web component listen to Aura Events [duplicate]

I have a Lightning Record Page which uses multiple components, some are LWC, some are Aura components. I am trying to figure out a way to make sure they all refresh nicely. For the Aura components, I ...
4
votes
2answers
1k views

The better way to import cometD library into LWC

I've been trying to use empAPI on community but unfortunately it's impossible. So I found this staff from trailhead https://github.com/forcedotcom/EMP-Connector.git Could anyone please describe me ...
2
votes
2answers
12k views

Lightning Web Component - Navigation - Show Link in a List / Table to Open Record

I need to create a link to an object within a data-table listing. For example, list of contacts on a data table, when the user clicks the "name", it opens that Contact record view. This seems simple ...
13
votes
2answers
7k 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="...
8
votes
2answers
3k views

How to show hyperlink in LWC toast

I have created a LWC that executes a call to the controller and shows a toast message if the call fails: const event = new ShowToastEvent({ title: "Error", ...
6
votes
1answer
4k views

Get RecordId in LWC From Community Page

I'm trying to make a component in my community be able to pull in the record Id. I followed the information in this question: LWC Community recordId undefined And this documentation: https://...
5
votes
3answers
11k views

Hyperlink record name LWC datatable

I am trying to fetch List of sobjects and show them in data table. I want to add a hyperlink to record name. I am using @wired property to dynamically get records depending on the search term. my ...
1
vote
1answer
748 views

Static JavaScript resource with LWC

LWC rookie here, How can we call a JavaScript function from LWC? For example I have the following static resource helloWorld.js and I'll like to use and call the function in the file. How can I ...
6
votes
1answer
996 views

LWC: File size restriction on js file

Today when deploying our code base we've run into the following error: lwc/orderGrid/orderGrid.js-meta.xml -- Error: Failed to save Lightning Component Resource [lwc/orderGrid/orderGrid.js] of ...
5
votes
2answers
231 views

Not able to import CSS in LWC No MODULE named markup:

I have created a Lightning web component named commonStyleSheets and deleted html, JS file and kept only CSS file as shown in the below image. Now if I import it by using 'c/commonStyleSheets' in ...
4
votes
2answers
3k views

Is there an equivalent to $A.get(“$Browser.formFactor”) in LWC?

We want to perform different logic in our LWC component js controller if the user is viewing our app in mobile. With aura components, we could do: if ($A.get("$Browser.formFactor") != 'DESKTOP') { ...
3
votes
3answers
4k views

Lightning Web Component Styling - Textarea

I am facing this issue in many out of the box LWC components. I am trying to change the style of text area by defining a css class. But it is failing to override the slds style at run time? Any idea? ...
3
votes
1answer
189 views

How to use Google API related javascript inside an LWC

Is there any way we can use Google Address plugin related javascript inside an LWC component like we have used inside the Visual force pages like below, <apex:component > <script src="https:/...
2
votes
2answers
3k views

How i can get the label of the selected value in Combobox - Lightning Web Components?

I'm developing a LWC Combobox and I want to get the label of the selected value in the handleChange() method, not the id. I filled the combobox with JSON Items in this form : {value :'Id', label:'...
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 ...
15
votes
2answers
9k 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'...
13
votes
2answers
18k 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 ...
11
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 ...
14
votes
1answer
4k 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 ...
4
votes
2answers
4k views

LWC download PDF file

I use LWC components in Customer Community. There is datatable component with records and I implemented the function to export selected records in .csv and .pdf. csv works fine, but I experience the ...
3
votes
3answers
2k views

Flatten data to display it using lightning datatable in LWC

My wrapper class returns sObjects of type account and contact along with other fields, to my LWC. I am not able to display the data using lightning datatable as something like fieldName:'AccountId....

1
2 3 4 5 6