Skip to content

Instantly share code, notes, and snippets.

@cassio-maletich
Forked from ordinz/modal_controller.js
Created November 28, 2021 02:50
Show Gist options
  • Select an option

  • Save cassio-maletich/49461f67218abca368394e7f02352d98 to your computer and use it in GitHub Desktop.

Select an option

Save cassio-maletich/49461f67218abca368394e7f02352d98 to your computer and use it in GitHub Desktop.
Extend Modal from "tailwindcss-stimulus-components"
import {Modal} from "tailwindcss-stimulus-components"
export default class extends Modal {
connect(){
this.element[this.identifier] = this
this.toggleClass = 'hidden'
}
}
import { Controller } from "stimulus"
export default class extends Controller {
someFunc(event) {
//opening the modal from outside
document.querySelector('#subscribe-modal').modal.open({ target: event.currentTarget })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment