You can use selectors to select elements within the components html template (shadow DOM) by providing a valid CSS selector.

  • select - Selects the first element that matches the selector.
  • selectAll - Selects all elements that match the selector.


When using selectors with Hooks, keep in mind that the template might not be yet rendered during certain Hooks like onStart and onReactive.


import Minze, { MinzeElement } from 'minze'

class MyElement extends MinzeElement {
  html = () => `
    <div id="my-div"></div>

  onReady() {
    const element ='#my-div')
    const elements = this.selectAll('div')
    console.log(element, elements)