Modal
A modal disables page content and focuses the user’s attention on a single task or message.
This component requires the following JavaScript plugin:
Examples
Default
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxAre you sure you want to continue?
You have unsaved changes that will be lost.
Large
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxAre you sure you want to continue?
You have unsaved changes that will be lost.
Forced Action
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxYour session will end soon.
You've been inactive for too long. Please choose to stay signed in or sign out. Otherwise, you’ll be signed out automatically in 5 minutes.
Component API
Root
- 
x-modalCustom Alpine directive that marks the Modal Root.
 
Trigger
- 
x-modal:triggerCustom Alpine directive that marks the Modal Trigger.
 
Dialog
- 
x-modal:dialogCustom Alpine directive that marks the Modal Dialog.
 - 
tabindexType:
number
Value:-1Prevents users from tabbing to this element.
Automatically handled with JavaScript.
 - 
aria-labelledbyType:
stringAccessibility attribute that links the Modal Dialog to the Modal Title via
id.Automatically handled with JavaScript.
 - 
aria-describedbyType:
stringAccessibility attribute that links the Modal Dialog to the Modal Description via
id.Automatically handled with JavaScript.
 - 
aria-modalValue:
trueAccessibility attribute that indicates that this element is a modal when displayed.
Automatically handled with JavaScript.
 - 
roleValue:
'combobox'Attribute that allows assistive technology identify that the content contained in the modal is grouped and seperate from the reast of the page content.
Automatically handled with JavaScript.
 
Content
- 
x-modal:contentCustom Alpine directive that marks the Modal Content.
 
Title
- 
x-modal:titleCustom Alpine directive that marks the Modal Title.
 - 
idType:
stringUsed to link the Modal Title to the Modal Dialog via
aria-labelledby.Automatically handled with JavaScript.
 
Description
- 
x-modal:descriptionCustom Alpine directive that marks the Modal Title.
 - 
idType:
stringUsed to link the Modal Description to the Modal Dialog via
aria-describedby.Automatically handled with JavaScript.
 
Close Button
- 
x-modal:close-button 
Custom Alpine directive that marks the Modal Close Button.
Backdrop
- 
x-modal:backdrop 
Custom Alpine directive that marks the Modal Backdrop.
This element is automatically appended to the document body, ensuring that this element always properly overlays page contents when opened.
Keyboard Interactions
- 
Escape
When the Modal Dialog is open, closes the Modal Dialog and moves focus to the Modal Trigger.