What is the syntax for conditional formatting within PnP Modern Search WebPart template?

Copper Contributor



I am trying to figure out the syntax for the PnP Search WebPart so that I may apply conditional formatting.

In this case, I would like to see if a column value is empty - then I would apply X CSS and if a column value's length is less than 2 , then apply this Y CSS.


Conventionally, I would imagine it would be something like this if the value is empty :
{{#if slot.item @root.,slots.Title.value empty}} 
<div>..CSS here </div>


AND something like this if the string length is greater than 2 :
{{#if slot.item @root.,slots.Title.value >len(2)}} 
<div>..CSS here </div>

I would very much appreciate any assistance.




0 Replies