For questions about Lightning Web Components (LWC) - the UI framework for the Salesforce platform. When using this tag also include the more generic [salesforce] tag.
Questions tagged [lwc]
503 questions
2
votes
0 answers
How to convert npm module for use in Salesforce LWC
I want to use the below npm package 'wordwrapjs' in a lwc Salesforce component but lwc does not support the out of the box. Is there an easy way to convert an npm module into a lwc component?
Guess I can manually copy and add in the js from the npm…

Andrew
- 71
- 4
2
votes
1 answer
No keyboard accessibility on LWC tabs?
I have run into an accessibility requirement in building an LWC where the user must be able to use the keyboard to tab across tabs in a tabset (what a mouthful!).
I have a lightning-tabset with three lightning-tabs wrapped inside. Within each tab, I…

jackb
- 35
- 1
- 4
2
votes
1 answer
Custom edit template for custom type lightning datatable not rendering value in combobox but is right below it
I have extended the lightning-datatable in order to implement a working picklist editable datatable. I have created the template and the editTemplate as you can see below. The value is working fine in the template and outside the combobox in the…

codequestionaab
- 21
- 2
2
votes
1 answer
Calling Apex method with multiple signatures from LWC
I've noticed some interesting behavior in an LWC that I am building and haven't been able to find much info on the cause. Basically I have an Apex method declared with multiple signatures:
// myMethod with 2 param signature
@AuraEnabled
public…

Tyler Edwards
- 184
- 2
- 9
2
votes
2 answers
How to document LWC Salesforce components public variables with JSDoc?
JSDoc skips my public LWC variables.
Here is an example:
/**
* SomePublicVarName mode - default is false.
*
* @type {boolean}
*/
@api
somePublicVarName = false;
If I convert that to a function or a public…

Florian G
- 567
- 1
- 5
- 15
2
votes
2 answers
Regex for Alphanumeric Values and not two consecutive underscores underscore
I have a requirement in javascript to write a regex for the following condition
The Custom Metadata Record MasterLabel field can only contain underscores and alphanumeric characters. It must be unique, begin with a letter, not include spaces, not…

Pavan Sahil
- 23
- 2
2
votes
1 answer
Animate DOM Element on removal of Element
I have to animate the Toast Notifications, I am currently using the transition to show it coming from the top. It looks good to me, I want to stop the sudden moving of the other toast notifications so harshly, any way they can cover space smoothly…

Somya Tiwari
- 145
- 3
- 8
2
votes
1 answer
Unable to Change attribute in JS Object passed from Parent as API Variable in Lightning Web Component
When I am trying to change the value of an Api attribute in connected callback of my LWC, the value does not change. It retains the value coming from Parent.
Please find example code below:
export default class myLWC extends LightningElement{
…

Melyna Stark
- 23
- 3
2
votes
0 answers
Why a button in LWC component vanishes when its running in the debug mode but the same is shown in the normal mode?
Why a button in LWC component vanishes when its running in the debug mode but the same is shown in the normal mode

Ahsan Hassan
- 21
- 1
2
votes
2 answers
Sorting by 3 different criteria in JavaScript
I am trying to sort this List below, first by Relationship(If it is subscriber then it should be first) then by Active vs inactive. Active should be before Inactive then each of the active and inactive should be sorted by descending age order.
So I…

Drake
- 21
- 4
2
votes
2 answers
Salesforce - Display hover text when hovering on the standard lightning button that is disabled
Salesforce -
I have a standard lightning button on the salesforce page. There are some conditions to show the button and to disable it. When the condition doesn't satisfy then I need to disable the button and when we hover on that disabled button,…

chandu
- 21
- 1
- 2
2
votes
2 answers
Validate multiple required LWC's on same flow screen, WITHOUT losing values
So I've recently started jumping into LWC's more seriously, and I'm trying to figure it all out. I've created a custom picklist flow component which accepts a collection of strings as options (why this isn't standard I'll never know). I've managed…

Rob Garrett
- 41
- 4
2
votes
1 answer
In Salesforce Lightning Web Component, How can I find if I am using Salesforce Mobile App OR Mobile browser
We can get the device size and the type by using LWC's '@salesforce/client/formFactor' module. But how can I get if I am working on Mobile App or mobile Browser in LWC.
I believe the above module will always give form factor SMALL as both are in…

jai gupta
- 69
- 6
2
votes
1 answer
Need to update table with change of Picklist value in LWC
Have got an accounts list that passes info to child component. Need that with change value of picklist(valueType in handleChange), accounts list would change also and pass renewed info to child component. Right now handleChange in list.js, do…

Meatinboots
- 31
- 1
- 3
2
votes
2 answers
Lightning Web Component: recordId unavailable from inside constructor
The following code prints "undefined from constructor" but gets the correct recordId when used by the button click from handleClick(). Would anyone know what I'm missing? Thank you in advance.
import { LightningElement, api } from 'lwc';
export…

MrRay_ME
- 41
- 1
- 5