<my-ce name="Initial Name"></my-ce>

<script>
  class MyCe extends HTMLElement {
    constructor() {
      super()
      this.textContent = 'Hello, World!'
    }
    static get observedAttributes() {
      return ['name']
    }

    attributeChangedCallback(name, oldValue, newValue) {
      if (name === 'name') {
        this.textContent = newValue
      }
    }
  }
  customElements.define('my-ce', MyCe)
</script>

Define attributeChangedCallback

The attributeChangedCallback method is called when an observed attribute changes. It updates the text content of the element based on the new attribute value.