Web Component Usage Modal is a web component. You can simply use <bolt-modal> in the markup to make it render. In the following examples, we use data-bolt-modal-target to trigger the modal. However, the same options shown on the Usage Javascript page are also available on the web component.
This is a modal.
<button type="button" class="e-bolt-button" data-bolt-modal-target=".js-bolt-modal-demo">
  Open Modal
</button>
<bolt-modal class="js-bolt-modal-demo">
  This is a modal.
</bolt-modal>
Basic Usage The modal container has 3 sections (slots) for passing content, header, default, footer. To pass content to either the header or footer, slot must be defined.
This is the header This is the body (default). This is the footer
<button type="button" class="e-bolt-button" data-bolt-modal-target=".js-bolt-modal-basic-demo">
  Open Modal
</button>
<bolt-modal class="js-bolt-modal-basic-demo">
  <bolt-text slot="header">This is the header</bolt-text>
  <bolt-text>This is the body (default).</bolt-text>
  <bolt-text slot="footer">This is the footer</bolt-text>
</bolt-modal>
Advanced Usage The web component has all the options shown in the schema table. You can define each prop on the <bolt-modal> element. Use unique combinations to customize a modal to your liking.
<button type="button" class="e-bolt-button" data-bolt-modal-target=".js-bolt-modal-advanced-demo">
  Open Modal
</button>
<bolt-modal width="optimal" spacing="none" theme="none" scroll="overall" class="js-bolt-modal-advanced-demo">
  <bolt-image src="/images/placeholders/backgrounds/background-dark2.jpg" alt="This is an image"></bolt-image>
</bolt-modal>