I am new to lightning web components and I want to make a custom lwc and put it inside another custom lwc.

I know this is achievable via lightning with

<c:yourCustomComponent attribute1="value1" attribute2="value2"/>

But I'm not finding any clue on how to do this with web components.

Is there a way to achieve this?


You can check this documentation Set Properties on Child Components.

NOTE Property names in JavaScript are in camel case while HTML attribute names are in kebab case (dash-separated) to match HTML standards. In todoApp.html, the item-name attribute in markup maps to the itemName JavaScript property of c-todo-item.

Your code should be like:

<c-your-custom-component attribute1="value1" attribute2="value2" att3={trackedJavascriptProperty}></c-your-custom-component>
  • Thanks a lot! That's exactly what I needed
    – molinet
    Sep 18 '19 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.