Creating a modal


Is there a documentation out there on how we can create a modal in Prismic? I would need it to be a modal which could be a part of multiple slices. So maybe the hero section can open it or the cta section can open it.

I'm thinking of creating a "Modal" tab with a slicezone with multiple modal variations. Then for each modal, have an id which the slices in "main" can relate to.

Any better recommendations are welcome!


Hello Kris,

Thanks for posting this question to us. This is indeed a good question.

Your approach is good to create a "Modal" tab with a slicezone with multiple modal variations.

I can think of one option as well:

You can create another custom type for the modal and define the modal’s content structure as you want on the front end. Then, you can create content for different modals as per structure in modal custom type. With the help of content relationship, you can link those modal content with pages(CTA/Link, etc.), and with fetchLinks queries, you can get all of the content in your code and choose what should be displayed as part of the modal.

Let me know your thoughts on this.



This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.