I am trying to show number of components in same section by using LWC. I can able to acheive this using "v.body" in lightning.. But I am not sure if I can acheive the same in LWC.

enter image description here

From above picture, If I click on any row, it will open next-page on the same section.. I need a similar one with LWC.. I read somewhere I can use slot for this, but not able to complete.

Can anyone help?

1 Answer 1


You can't create components dynamically, but you can show/hide components dynamically.

<!-- markup -->
  <c-product-list if:false={selectedProduct} onselect={showSelection}></c-product-list>
  <c-product-detail if:true={selectedProduct} product={selectedProduct}></c-product-detail>

// controller code
showProduct(event) {
  this.selectedProduct = event.detail.product;

Obviously, the actual details will depend on your code, and there's some abstraction going on here you'll need to puzzle out, but it's pretty straight forward once you get used to it.

You must log in to answer this question.

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