diff --git a/www/examples.md b/www/examples.md index 640993d4..b417c30f 100644 --- a/www/examples.md +++ b/www/examples.md @@ -21,5 +21,8 @@ You can copy and paste them and then adjust them for your needs. | [Active Search](/examples/active-search) | Demonstrates the active search box pattern | [Progress Bar](/examples/progress-bar) | Demonstrates a job-runner like progress bar | [Value Select](/examples/value-select) | Demonstrates making the values of a select dependent on another select -| [Dialogs](/examples/dialogs) | Demonstrates the prompt and confirm dialogs | [Animations](/examples/animations) | Demonstrates various animation techniques +| [Dialogs - Browser](/examples/dialogs) | Demonstrates the prompt and confirm dialogs +| [Dialogs - UIKIt](/examples/modal-uikit) | Demonstrates modal dialogs using UIKit +| [Dialogs - Bootstrap](/examples/modal-bootstrap) | Demonstrates modal dialogs using Bootstrap + diff --git a/www/examples/modal-bootstrap.md b/www/examples/modal-bootstrap.md new file mode 100644 index 00000000..fd218e2f --- /dev/null +++ b/www/examples/modal-bootstrap.md @@ -0,0 +1,125 @@ +--- +layout: demo_layout.njk +--- + +## Modal Dialogs in Bootstrap + +Many CSS toolkits include styles (and Javascript) for creating modal dialog boxes. +This example shows how to use HTMX to display dynamic dialog using Bootstrap, and how to +trigger its animation styles in Javascript. + +We start with a button that triggers the dialog, along with a DIV at the bottom of your +markup where the dialog will be loaded: + +```html + + +
+``` + +This button uses a `GET` request to `/modal` when this button is clicked. The +contents of this file will be added to the DOM underneath the `#show-modals-here` DIV. + +We're replacing Bootstrap's javascript widgets with a small bit of Hyperscript to provide +smooth animations when the dialog opens and closes. + +Finally, the server responds with a slightly modified version of Bootstrap's standard modal + +```html + +This modal dialog was loaded dynamically by HTMX.
+ + +