0

In the SLDS documentation, I've found a whole page about expressions, how to use them and how to make them similar to the ones implemented in Salesforce UI.

example image

Does exist something similar as a lightning component and/or as a lightning web component or should I have to implement it by myself? I've searched the component library without success.

1 Answer 1

0

LWC's as of now do not support conditional expressions when rendering any content. So you wont be able to use conditions like

<template  if:true={AND(OR(a,b),c)}></template>

Instead you can get the values from js file

get isTestCondnMet(){
     return ((a || b) && c);
}

and use this in html to render your contents

<template  if:true={isTestCondnMet}>
    Your content goes here
</template>

Hope this answers your question.

2
  • Thanks for your kindly reply but I don't understand how this could help me. I was looking for a component already implemented by Salesforce. Since there is a whole chapter about expressions I thought that it was somewhat a standard that one could use in lightning web/aura component.
    – gvgramazio
    May 27, 2019 at 11:37
  • In the last days I worked on build this functionality from scratch. When it will be completed I will post here as future reference even if I'm still hoping for a solution that doesn't involve building it from scratch for easier maintenance in future Salesforce releases.
    – gvgramazio
    May 27, 2019 at 11:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .