1

I would like to know whether the following is possible.

I have created two custom lighting component called menu and menu-item

Can I use these two as follows.

<c-menu>
    <c-menu-item lable="item1"/>
    <c-menu-item lable="item2"/>
</c-menu>

I have seen some standard components use this pattern.

2

You can certainly do this with the help of slots.

In your template markup for the c-menu component you will leave an unnamed slot there as below

<template>
  <!-- all markups-->
 ---
  ---
   <slot> </slot>
</template>

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.