# $modal

### Basic Usage

The modal plugin is a helper utility to make using Modal's programmatically into a single line of code. This plugin is similar to the $popover and $overlay plugins. The most basic example mimics the DOM usage in that modal is triggered after an event on a specified target.

Click to Show

### Instantiate modal after click

In most cases the plugin is meant to be used by triggering the modals programmatically without waiting for an event to trigger on a target. If no target is specified, the modal will show once it has been mounted.

Click to Show

### Modal Types

JavaScript provided some native functions to handle alerts, confirmations, and prompts. There is very little control over the UX with these functions. The modal helper methods are designed to mimic the native functionality (as a concept), but provide a promise based approach.

Show Alert Show Confirmation Show Prompt

### Prompt Validation

The only modal type that is meant to accept user input beyond a boolean value. Thus, it's likely you need to validate the user input, or do something asynchronously before the modal closes and resolves/rejects the promise.

Show Prompt w/Validation