How do I theme the core modal with twig? Drupal 8 comes with built in modals.

This works:

&lt;a href="/node/11" class="use-ajax" data-dialog-type ="modal"&gt;modal&lt;/a&gt;


How can I style that modal using twig, to add new classes to the box? The intention is to take over the bootstrap style language.
Modals in Drupal are built with jQuery UI. If you want to add just some class to the modal window, you can make use of the dialogClass option.

&lt;a href="/node/11"
  class="use-ajax"
  data-dialog-type="modal"
  data-dialog-options="{&amp;quot;dialogClass&amp;quot;:&amp;quot;foobar&amp;quot;}"&gt;Click me&lt;/a&gt;


or

\Drupal\Core\Link::createFromRoute(t('Click me'), 'entity.node.canonical', [
  'node' =&gt; 11,
], [
  'attributes' =&gt; [
    'class' =&gt; ['use-ajax'],
    'data-dialog-type' =&gt; ['modal'],
    'data-dialog-options' =&gt; \Drupal\Component\Serialization\Json::encode([
      'dialogClass' =&gt; 'foobar',
    ]),
  ],
]);


but that won't make you a Bootstrap modal. For that you could either dynamically load the node and build the markup completely following the Bootstrap sample with a button targeting a &lt;div&gt; with a certain ID (nah, probably not the best idea, performance-wise).

OR you could make use of view modes and the concept of the View Mode Page module.


  Create separate pages for different view modes for a given content type.


That is, you create a new view mode for your node type for example mymodal, where you display only the fields you need and where you have full control over the markup using a view-mode-specific template like for example node--article--mymodal.html.twig. Now you can build the markup exactly like Bootstrap needs it. And finally link to this node in that view mode: /node/11/mymodal

or

\Drupal\Core\Link::createFromRoute(t('Click me'), 'view_mode_page.display_entity', [
  'view_mode' =&gt; 'mymodal',
  'entity_type' =&gt; 'node',
  'entity_id' =&gt; 11,
], [
  'attributes' =&gt; [
    'class' =&gt; ['use-ajax'],
    'data-dialog-type' =&gt; ['modal'],
  ],
]);


The only thing that would be missing now is to hide the jQuery UI modal title bar, 'title': FALSE didn't do it. But just CSS would do.