Skip to content

Modal

BsModal is a popup dialog component that brings information to the user. It also provides actions through the action buttons to prompt the user for input or to ask for a decision. The component can also contain more complex UI elements that require the focus of the user.

Overview

BsModal uses <bs-overlay> component internally and can be closed using the ESC key (enabled by default), or clicking the backdrop (enabled by default). BsModal doesn't have any button, to achieve this you can add the appropriate action buttons on the footer slot.

When a dialog contains complex UI or you want to have appropriate dialog size, it is good to define the width property and max-width property to a desire value.

Hiding The Overlay

Overlay or backdrop is enabled by default. To hide the overlay, sets overlay property to false.

True Modal Dialog

You can show a modal dialog by setting the overlay-click-close property to false.

Scrolling Long Content

When dialog content become too long, you can make the dialog content scrollable.

CSS Variables

Added since v2.0.0
scss
--md-modal-background: #fff;
--md-modal-border-radius: 1rem;
--md-modal-header-padding: 1.5rem 1.5rem 1.25rem;
--md-modal-body-padding: 1.5rem 1.5rem 1.25rem;
--md-modal-footer-padding: 0.5rem 1rem 1rem 1rem;
--md-modal-max-width: 80%;

API Reference

Released under the BSD-3-Clause License.