{% include '@bolt-elements-button/button.twig' with {
content: 'Open Modal',
attributes: {
type: 'button',
'data-bolt-modal-target': '.js-target-name',
}
} only %}
{% include '@bolt-components-modal/modal.twig' with {
content: 'This is a modal',
attributes: {
class: 'js-target-name'
},
} only %}
Prop Name | Description | Type | Default Value | Option(s) |
---|---|---|---|---|
attributes
|
A Drupal attributes object. Used to apply additional HTML attributes to the outer <bolt-modal> tag. |
object
| — |
|
width
|
Controls the width of the modal container. |
string
|
optimal
|
|
spacing
|
Controls the spacing around the modal container. |
string
|
medium
|
|
persistent
|
Enables the modal to be persistent. This will eliminate ways to close the modal and it is up to the author to provide a custom link to close the modal or redirect to another page within the modal content. Must be used in tandem with the |
boolean
|
false
|
|
persistent_return_url
|
The URL to be used on a return link. If a modal is persistent, a return link is required to provide the user a way out. Must be used in tandem with the |
string
| — |
|
theme
|
Controls the color theme of the modal container. |
string
|
xlight
|
|
scroll
|
Controls the scrolling area. |
string
|
container
|
|
uuid
|
Unique ID for modal, randomly generated if not provided. |
string
| — |
|
npm install @bolt/components-modal
This is the modal container's header.
This is the modal container's body.
This is the modal container's footer.
width
prop. The default is set to optimal
.
|
This is taking up the full width of the screen minus the gutters (about 2rem on left and right). |
---|---|
|
This is 10 out 12 columns wide, about 80% of the screen width. |
|
This is about 75 characters wide, close to optimal reading length. |
|
This adjusts to the width of the modal content. In most cases, the user must define a max-width in absolute value (do not use relative value such as %) on the modal content to get the desired results. Recommended for advanced usage. |
Additional Notes: this prop only applies to viewports equal to or above the small breakpoint (~600px). |
spacing
prop. The default is set to medium
.
|
This removes the spacing inside the modal container. |
---|---|
|
This sets small inset spacing on the modal container. |
|
This sets medium inset spacing on the modal container. |
|
This sets large inset spacing on the modal container. |
Additional Notes: this prop only applies to viewports equal to or above the small breakpoint (~600px). |
theme
prop. The default is set to xlight
.
|
This makes the modal container transparent. |
---|---|
|
This sets the xlight theme on the modal container. |
|
This sets the light theme on the modal container. |
|
This sets the dark theme on the modal container. |
|
This sets the xdark theme on the modal container. |
Additional Notes: this prop only applies to viewports equal to or above the small breakpoint (~600px). |
scroll
prop. The default is set to container
.
|
This makes the overall viewport area scrollable. |
---|---|
|
This makes the modal container itself scrollable. |
Additional Notes: this prop only applies to viewports equal to or above the small breakpoint (~600px). |
|
The Button component is the standard method to trigger a modal. |
---|---|
|
Image trigger can be created by wrapping the Trigger component around an Image component. Advanced usage: if the Image component has an absolute value (e.g. 640px) defined for |
Link trigger
|
Buttons are preferred for opening a modal, but you can use a link in a pinch. |
data-bolt-modal-target
attribute. The value of this attribute is the target modal's class. There is JS that will handle the opening on target modal based on the attribute's value.video-js
requires a couple of attributes to delay the initialization. There are four attributes that are required, three of these replace the default Brightcove attributes.This is a paragraph. Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor posuere. Praesent id metus massa, ut blandit odio. Proin quis tortor orci. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu ullamcorper orci. Quisque eget odio ac lectus vestibulum faucibus eget in metus. In pellentesque faucibus vestibulum. Nulla at nulla justo, eget luctus tortor. Nulla facilisi. Duis aliquet egestas purus in blandit. Curabitur vulputate, ligula lacinia scelerisque tempor, lacus lacus ornare ante, ac egestas est urna sit amet arcu. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed molestie augue sit amet leo consequat posuere. Vestibulum ante.
This Is an Eyebrow
This Is a Subheadline
This is a paragraph. Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor posuere. Praesent id metus massa, ut blandit odio. Proin quis tortor orci. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu ullamcorper orci. Quisque eget odio ac lectus vestibulum faucibus eget in metus. In pellentesque faucibus vestibulum. Nulla at nulla justo, eget luctus tortor. Nulla facilisi. Duis aliquet egestas purus in blandit. Curabitur vulputate, ligula lacinia scelerisque tempor, lacus lacus ornare ante, ac egestas est urna sit amet arcu. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed molestie augue sit amet leo consequat posuere. Vestibulum ante.
persistent
and persistent_return_url
. When a modal is persistent, the default close button is not shown, the only ways to close the modal is through filling out the form, hitting the return link, or hitting the escape key on the keyboard (which acts exactly like the return link).Modal content can be anything. Content authors are free to set up single or multiple column layouts. The recommended format is text content on the left and form on the right. The return link is required, which is in its own cell under both the text content and form cells. It should not be part of the free-form authorable content, instead two required fields are required for content authors to input: return link url and return link text.
(all fields are required)