lwc:spread Spread Properties on Child Components



  • lwc : spread Pass a set of properties in an object to a child component.
  • lwc:spread also enables elements to accept an object that's bound as properties at runtime.
  • The lwc:spread directive accepts one object.
  • Use an object with key-value pairs, where the keys are property names.
  • In your child component, use the properties in your template.
  • Use the @api decorator to expose your properties to the parent component.
  • lwc:spread is always applied last, so it overrides any properties that are directly declared in the template. Only one lwc:spread instance can be used on a directive


Example Below:

Parent LWC Component:


Child LWC Component:


Like our post & bookmark this blog for your future learning. Any suggestions and improvements are most welcome, please comment your suggestions and improvement in the comment box. 😍😍Happy Coding Sharing is Caring 😍😍

إرسال تعليق

Post a Comment (0)

أحدث أقدم