Skip to content

Instantly share code, notes, and snippets.

@goliatone
Forked from ordinz/modal_controller.js
Created June 27, 2024 21:09
Show Gist options
  • Save goliatone/aabf2c00b9ca58f7287dd4d5caa6e08f to your computer and use it in GitHub Desktop.
Save goliatone/aabf2c00b9ca58f7287dd4d5caa6e08f 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