Form associated element

<form>
  <my-ce></my-ce>
</form>

<script>
  class MyCe extends HTMLElement {
    static formAssociated = true
  }
  customElements.define('my-ce', MyCe)
</script>

Done 🎉

Now your custom element can participate in form submission and validation. Check form.elements to see your element.