function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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
https://jayakrishnasfdc.wordpress.com/2020/12/05/conditional-rendering-in-lwc/

https://www.sfdcamplified.com/2020/07/conditional-rendering-in-lwc.html

If it helps mark it as best answer.

Thanks!
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.
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.js_props_getter

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