How to pass Webform elements from controller to custom twig template
my_module.module:

/**
 * Implementation of hook_theme
 *
 * Since we have a lot to explain, we're going to use Twig to do it.
 */
function my_module_forms_theme($existing, $type, $theme, $path) {
  return [
    'my_template' =&gt; [
      'template' =&gt; 'my-template',
      'variables' =&gt; ['form' =&gt; NULL],
    ],
  ];
}