{"id":28322284,"url":"https://github.com/melmacaluso/vue-modal","last_synced_at":"2025-06-23T20:31:20.543Z","repository":{"id":143760715,"uuid":"172108471","full_name":"MelMacaluso/vue-modal","owner":"MelMacaluso","description":"Reusable Modal component, supports own custom HTML, text and classes.","archived":false,"fork":false,"pushed_at":"2019-03-27T15:23:13.000Z","size":587,"stargazers_count":29,"open_issues_count":1,"forks_count":9,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-01T22:24:34.289Z","etag":null,"topics":["dialog","javascript","modal","modals","popup","reusable","vue","vue2","vuecomponent","vuecomponents","vuejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MelMacaluso.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-02-22T17:39:26.000Z","updated_at":"2022-08-14T09:56:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"608c62ec-ee78-4fc4-a930-614b6502bb50","html_url":"https://github.com/MelMacaluso/vue-modal","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/MelMacaluso/vue-modal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MelMacaluso%2Fvue-modal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MelMacaluso%2Fvue-modal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MelMacaluso%2Fvue-modal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MelMacaluso%2Fvue-modal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MelMacaluso","download_url":"https://codeload.github.com/MelMacaluso/vue-modal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MelMacaluso%2Fvue-modal/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261552457,"owners_count":23176166,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dialog","javascript","modal","modals","popup","reusable","vue","vue2","vuecomponent","vuecomponents","vuejs"],"created_at":"2025-05-25T14:09:33.714Z","updated_at":"2025-06-23T20:31:20.436Z","avatar_url":"https://github.com/MelMacaluso.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Vue Modal 🖼\n[![npm](https://img.shields.io/npm/dw/@melmacaluso/vue-modal.svg?label=Downloads)](https://www.npmjs.com/package/@melmacaluso/vue-modal)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n![CircleCI (all branches)](https://img.shields.io/circleci/project/github/MelMacaluso/vue-modal.svg)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n\n\u003cdiv align=\"center\"\u003e\n\n![Reusable Modal component, supports own custom HTML, text and classes and/or passing a component. Featuring multiple modal content / buttons.](https://user-images.githubusercontent.com/24974216/55087239-b2b9f980-50a1-11e9-8924-499b6cbfe965.png)\n\n\u003c/div\u003e\n\n## Intro\n\nReusable Modal component, supports own custom HTML, text and classes and/or passing a component. Featuring multiple modal content / buttons.\n\n## What this ISN'T\n\nThis component is not meant to be a bootstrap-ish already-styled-modal-replacer for Vue.\n\n## What this IS\n\nInstead: it wants to take it a step further: it gives you a skeleton base structure where you are free to apply your own css styling according to your requirements/website and gives you freedom of formatting the content/arrows/buttons/events as you wish with little to no effort.\n\n## Features\n\n- Animated modal transition\n- Overlay on modal background\n- Custom event triggering on `before-close` and `before-open`\n- Conditional: Next/prev arrows, close button, paging\n- Next and prev arrow for switching between modal contents\n- Modal contents navigation with custom paging\n- CSS/HTML customisation of: prev/next arrows, modal content, modal\n  navigation, modal trigger button/s\n\n## Demo\n\u003cdiv align=\"center\"\u003e\n\n![Vue modal animated demo](https://media.giphy.com/media/7zoNLc5G8zJjWlyR3T/giphy.gif)\n\n\u003c/div\u003e\n\n- Code editor - [codesandobx](https://codesandbox.io/s/rmj2y345xo)\n- Preview - [codesandbox](https://rmj2y345xo.codesandbox.io/)\n\n## Installation\n\n```shell\nnpm i @melmacaluso/vue-modal\n```\n\n## Usage\n\nSimply import it in your desired vue component as follows:\n\n```javascript\nimport Modal from \"@melmacaluso/vue-modal\";\n```\n\n## Props\n\n| **Prop**           | **Type** | **Comment**                                                                                              |\n| ------------------ | -------- | -------------------------------------------------------------------------------------------------------- |\n| `btnText`          | String   | Text label for modal button                                                                              |\n| `modalContent`     | String   | Pass here your html for the modal main modal                                                             |\n| `closeBtn`         | Boolean  | Conditionally add a close button                                                                         |\n| `closeBtn-content` | String   | Pass here your html for the close button                                                                 |\n| `multiple`        | Boolean  | Allow multiple buttons/content within the modal                                                          |\n| `modals`           | Array    | Pass here an array of objects, they retain the same props within the array's scope ie. `\u003cscope\u003e.btnText` |\n| `showNav`          | Boolean  | Conditionally show a navigation with each modal's `btnText`                                              |\n| `showArrows`       | Boolean  | Conditionally show an arrow based navigation                                                             |\n| `showArrowsCloseBtn`       | Boolean  | Conditionally show an the close button between the prev/next arrows, it inherits `closeBtn-content`                                                             |\n| `arrowNextContent`  | String   | Pass here your html for the next arrow                                                                   |\n| `arrowPrevContent`  | String   | Pass here your html for the previous arrow                                                               |\n| `@before-open`     | Function  | Attach here your custom function, it will be invoked before the modal opens                              |\n| `@before-close`    | Function  | Attach here your custom function, it will be invoked before the modal closes                             |\n\n## Examples\n\n### Inline HTML:\n\n```vue\n\u003cModal\n  btnText=\"Press me, senpai 😊\"\n  modalContent=\"\n        \u003cdiv\u003e\n          \u003ch2\u003e Hello I am a modal\u003c/h2\u003e\n          \u003cp\u003eI like stating the obvious: \u003cb\u003ethe obvious\u003c/b\u003e\u003c/p\u003e\n          \u003cp\u003eNow, try this trick: \u003ccode\u003eCtrl + Shift + W \u003c/code\u003e 😉\u003c/p\u003e\n        \u003c/div\u003e\n        \"\n  :closeBtn=\"true\"\n  closeBtn-content=\"\n        \u003cspan\u003eX\u003c/span\u003e\n        \"\n/\u003e\n```\n\n### Passing component:\n\n```vue\n\u003cModal\n  btnText=\"Press me, senpai 😊\"\n  :closeBtn=\"true\"\n  closeBtnHTML=\"\u003cspan\u003eX\u003c/span\u003e\"\n\u003e\n  \u003cExampleComponent/\u003e\n\u003c/Modal\u003e\n```\n\n### Multiple buttons \u0026 modal content + custom functions:\n\n```vue\n\u003cModal\n  :multiple=\"true\"\n  @before-open=\"yourOpenFn()\"\n  @before-close=\"yourCloseFn()\"\n  :modals=\"[\n    {\n      btnText: 'Press me 1',\n      modalContent: 'This is \u003cstrong\u003ethe\u003c/strong\u003e content 1'\n    },\n    {\n      btnText: 'Press me 2',\n      modalContent:\n        '\u003cimg src=\\'https://media.giphy.com/media/5exwXWg9u7yow/giphy.gif\\'\u003e'\n    },\n    {\n      btnText: 'Press me 3',\n      modalContent: 'This is the \u003ch3\u003econtent 3\u003c/h3\u003e'\n    }\n  ]\"\n  :showNav=\"true\"\n/\u003e\n```\n\n### From Api/Json feed + Prev/Next Arrows:\n\n```vue\n\u003cModal\n  :multiple=\"true\"\n  :modals=\"formattedUsers\"\n  :showArrows=\"true\"\n/\u003e\n\nexport default {\n  data: () =\u003e {\n    return {\n      users: []\n    }\n  },\n  mounted(){\n    fetch('https://jsonplaceholder.typicode.com/users')\n      .then(res =\u003e res.json())\n      .then(res =\u003e this.users = res)\n      .catch(err =\u003e console.log(err))\n  },\n  computed: {\n    formattedUsers: function() {\n      return this.users.map(user =\u003e {\n        return {\n          btnText: `${user.name}`,\n          modalContent: `\n            \u003ch2\u003eEmail:${user.email}\u003c/h2\u003e\n            \u003ch2\u003ePhone:${user.phone}\u003c/h2\u003e\n          `\n        };\n      });\n    }\n  }\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelmacaluso%2Fvue-modal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelmacaluso%2Fvue-modal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelmacaluso%2Fvue-modal/lists"}