# @appoly/vue-modal

> A simple modal component built with Vue.js

Latest version **2.0.6** (published 2023-06-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install @appoly/vue-modal
pnpm add @appoly/vue-modal
yarn add @appoly/vue-modal
bun add @appoly/vue-modal
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.6 |
| Published | 2023-06-30 |
| First published | 2022-07-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 118.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Calum Chamberlain |
| Maintainers | calum1904, johnwedgbury, jordmondson, james.merrix |
| Keywords | vuejs, modals, modal, popup, toast |

## Links

- npm: https://www.npmjs.com/package/@appoly/vue-modal
- Repository: https://github.com/appoly/vue-modal
- Homepage: https://github.com/appoly/vue-modal#readme
- Issues: https://github.com/appoly/vue-modal/issues
- npm.io page: https://npm.io/package/@appoly/vue-modal

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [post-robot](https://npm.io/package/post-robot.md) — 93.7K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads

## Recent versions

- 2.0.6 (latest) — 2023-06-30
- 3.0.1 — 2023-06-30
- 3.0.0 — 2023-02-03
- 2.0.5 — 2022-08-12
- 2.0.4 — 2022-08-12
- 2.0.3 — 2022-08-12
- 2.0.2 — 2022-08-12
- 2.0.1 — 2022-07-29
- 2.0.0 — 2022-07-29
- 1.0.2 — 2022-07-22
- 1.0.1 — 2022-07-22
- 1.0.0 — 2022-07-22

## README

# Vue Modal

<p align="center">
  <img src="https://img.shields.io/npm/v/@appoly/vue-modal" />
  <img src="https://img.shields.io/npm/dt/@appoly/vue-modal" />
</p>


<p align="center">
  <img src="https://www.appoly.co.uk/app/uploads/2022/07/vue-modal-2.gif" />
</p>

## Installation

Install Vue Modal with npm

```bash
npm install @appoly/vue-modal
```

## Props

| Prop                  | Type     | Default | Description                                                                                        |
| :-------------------- | :------- | :------ | :------------------------------------------------------------------------------------------------- |
| `confirmButtonText`   | `string` | Confirm | Text displayed on the confirm button                                                               |
| `confirmButtonClass`  | `string` |         | Custom class for the confirm button                                                                |
| `closeOnOutsideClick` | `bool`   | `true`  | Close the modal by clicking on the outside                                                         |
| `showConfirmButton`   | `string` | `true`  | Display the confirm button                                                                         |
| `cancelButtonText`    | `string` | Cancel  | Text displayed on the cancel button                                                                |
| `cancelButtonClass`   | `string` |         | Custom class for the cancel button                                                                 |
| `closeOnButtonClick`  | `bool`   | `true`  | Modal can be closed on cancel/confirm click or an event is emitted and can be closed via functions |
| `escClosesModal`      | `bool`   | `true`  | Should the modal close if the Esc key is pressed (and `closeOnOutsideClick` is True)               |
| `animation`           | `string` | `zoom`  | Animation type, options include `zoom, bounce, fade & none`                                        |
| `timeout`             | `number` | `0`     | Should the modal automatically close, time set in milliseconds                                     |
| `width`               | `string` | `700px` | Width of the modal in px, rem, em, %. Just numbers default to px                                   |
| `maxHeight`           | `string` | `75%`   | Height of the modal in px, rem, em, %. Just number default to px                                   |
| `sticky-header`       | `bool`   | `false` | Should the modal have a sticky header                                                              |
| `sticky-footer`       | `bool`   | `false` | Should the modal have a sticky footer                                                              |

## Slots

| Slot      | Description                                             |
| :-------- | :------------------------------------------------------ |
| `header`  | Content for the top of the modal                        |
| `body`    | Content for the center of the modal                     |
| `footer`  | Content for the bottom of the modal (above the buttons) |
| `buttons` | Replaces the buttons                                    |

## Usage/Examples

```javascript
import VueModal from '@appoly/vue-modal';
```

```vue
<VueModal ref="myModal" timeout="5000">
    <template #header>
        <h1>My Modal</h1>
        <hr>
    </template>
    <template #body>
        <p>This modal will hide in 5 seconds</p>
    </template>
</VueModal>
```
## Open Modal
```javascript
this.$refs.myModal.openModal();
```

## Close Modal
If closeOnButtonClick is turned off you will need to listen for the `confirm` and `cancel` events and close the modal using

```javascript
this.$refs.myModal.closeModal();
```

---
_Source: https://npm.io/package/@appoly/vue-modal · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
