Dynamic / Conditional Slices on a Page


is there a way to dynamically display slices on a page? So if you had 2 tabs on a page, and you wanted 3 slices to go under each, but only display the 3 when the tab header was clicked.

I want to use slices we currently have and not edit them for this specific page. Can it be controlled by another means?

Conversely, could we have dynamic content of the 3 slices and depending upon which tab was selected, change the content shown?



Hey Pete, thanks for reaching out!

Everything you mentioned is possible from the front-end of your application. The concept of tabs within your documents helps you structure this content division so that later you can use that logic to "conditional render" components in the code of your site.

That is, you can use a conditional statement to make Slices appear when the "header" tab is active. All this will depend on what technology you are using. Do you have access to the project code?

thanks for the quick response Pau.

We are using nextjs/react and yep I do have access to it.

How are you passing the document data to your pages?
A good place to start is to start creating a component per Slice.

This thread has been closed due to inactivity. Flag to reopen.