Creating a webform modal is quite simple and straight forward in Drupal 8.
We only need the Webform module and some classes for the modal opening button:
- Download and install https://www.drupal.org/project/webform
- Create a webform
- Check (allow) the webform decicated URL option in the webform settings: /structure/webform/manage/MYFORM/settings:
- Optionally change the URL or leave the field empty to use the default (see help icon)
- Optionally allow parameter prepopulation in fields, if you'd like to provide a parameter via webform URL
- Add the class "use-ajax" and the data attribute: "data-dialog-type='modal'" to your trigger button:
- Add modal styling, if required
That's it! :)
More information (but a bit older): https://www.previousnext.com.au/blog/understanding-drupal-8s-modal-api-…