<form>
  <my-ce name="foo"></my-ce>
</form>

<script>
  class MyCe extends HTMLElement {
    static formAssociated = true
    constructor() {
      super()
      this._internals = this.attachInternals()
    }

    connectedCallback() {
      this._internals.setFormValue('Hello, World!')
    }
  }
  customElements.define('my-ce', MyCe)
</script>

Done 🎉

Now whenever you post the form, foo (name) will have a value Hello, World!.