I want to set up a universal modal. how do i do that?

Would creating a custom modal component be a solution?

I started to create one, but havent had the time to finish it. My goal is to be able to add multiple modals on a the same page without the need to create specific variables for show/hiding the correct modal.

The component basically exists of:

  • A button that opens the modal (when you drop the component on the canvas, the button is the only thing that is visible, keeping the canvas clean during development.
  • A custom modal inspired by this thread
  • In the custom modal I add a component placeholder, so you can add specific stuff like data or a form, on custom components level.
  • Adding some properties to the component you make stuf more dynamic and generic, like “Title” (that is shown on the button, but also on the custom modal).

I was able to drop this modal multiple times on a page, having each modal in it’s own context, without the need to create specific variables to show/hide each modal an the page.