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

Copper Contributor

Hello,

 

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>
{{/if}}

 

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>
{{/if}}

I would very much appreciate any assistance.

 

Regards,
Mike

 

0 Replies