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.

1 Answer 1

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>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .