Skip to content

Instantly share code, notes, and snippets.

@ordinz
Created March 19, 2021 07:46
Show Gist options
  • Save ordinz/16994990eced35b22966242eefc7cffa to your computer and use it in GitHub Desktop.
Save ordinz/16994990eced35b22966242eefc7cffa 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