+ Start a Discussion
Sujata Gusain 6Sujata Gusain 6 

hiding field based on condition in LWC, condition is when contacts list is less then 5 button is hide.

AbhinavAbhinav (Salesforce Developers) 
Hi Sujata,

If we want to hide some of the components from the HTML and show it based on conditions then we can use conditional rendering.

Check this blog


If it helps mark it as best answer.

Yogendra JangidYogendra Jangid
Hello Sujata, 
You can use <template if:true={getterMethod}> or <div if:true={getterMethod}> and you can check for the contact list size to be greater than 5. If it is greater than 5, return as true or else false and the corresponding element inside div or template will be hidden. To know more on how to use getter in LWC, follow this link.

If this solves your query, please can you mark this as the best answer. Many thanks.