A modal is a secondary window that communicates or provides an action inside the same process.

installyarn add @clayui/modal
versionNPM Version
useimport Modal from '@clayui/modal';

Sizes

Small

300px wide modal window, expands full width of screen at 575px and below.

Snippet

Default

500px wide modal window, expands full width of screen at 575px and below.

Snippet

Large

The large modal is an 800px wide window on displays greater than 992px. It is a 500px wide modal on displays between 576px and 991px. It expands full screen width on displays 575px and below.

Snippet

Full Screen

All Screen Sizes

The full screen modal stretches to fit the browser window, with 45px spacing on every side, and expands to fill the screen on displays 767px and below.

Snippet

Sm Down

Add modal-full-screen-sm-down to any modal-dialog to stretch to fit the browser window at screen widths 767px and below.

Snippet

Height

Small

Add the class modal-height-sm to the modal or modal-dialog element to fix the height of the modal to 250px.

Snippet

Medium

Add the class modal-height-md to the modal or modal-dialog element to fix the height of the modal to 450px.

Snippet

Large

Add the class modal-height-lg to the modal or modal-dialog element to fix the height of the modal to 650px.

Snippet

Extra Large

Add the class modal-height-xl to the modal or modal-dialog element to fix the height of the modal to 800px.

Snippet

Full Screen

Add the class modal-height-full to the modal or modal-dialog element to expand the modal to fit to the height of the browser’s window.

Snippet

Configurations

Lexicon allows your modal window to have different configurations to suite your needs. Because these needs can vary greatly, there are certain rules your modal must follow.

A classic modal window is composed of three main parts: header, body, and footer.

Snippet

Insert a Navigation or Input Group between the Header and Body

Snippet

Snippet

Header and Body

When you don’t need a footer bar to place your icons, you can just have a header and body element in your modal, as shown below:

Snippet

When you just need to show text and buttons to agree or cancel, you can just have a body and footer element in your modal, as shown below:

Snippet

Grid

Utilize the Bootstrap grid system within a modal by nesting .container-fluid within the .modal-body. Then, use the normal grid system classes as you would anywhere else.

Snippet

Iframe

You can add an Iframe to the modal body.

Add the modal-body-iframe class to a modal-body element when you want the iframe to be the same width and height as the modal-body element.

In mobile safari (iOS 8.3), any content inside an iframe that triggers a browser reflow will cause the iframe to scroll to the top.

In mobile safari (iOS 8.3), any content inside an iframe that triggers a browser reflow will cause the iframe to scroll to the top.

Snippet

Status Messages

Modal headers can be configured to use modals as status messages. This emphasizes blocking actions that the user must read and pay careful attention to.

Add one of the following helper classes to the modal-dialog element to style is with corresponding state: modal-danger, modal-info, modal-success, or modal-warning.

Success

Snippet

Info

Snippet

Warning

Snippet

Danger

Snippet

Helpers

Use classes modal-item-first, modal-item, and modal-item-last inside modal-footer to align content left, middle, and right.

Vertically Centered

Add .modal-dialog-centered to .modal-dialog to vertically center the modal.

Snippet

Remove Animation

For modals that simply appear rather than fade in to view, remove the .fade class from your modal markup.

Inline Scroller

inline-scroller is a helper class that sizes modal-body to a fixed height and scrolls any overflowing content. Add it to modal-body when you want modal-body to be a fixed height. It defaults to height 125px.

Snippet

Edit this page on GitHub

Contributors

Matuzalém Teles

Last edited May 12, 2025 at 7:56:02 PM