Web component / esm

<form-repeatable>

Import the class and register it manually. See the README for the full API.

A contact’s email addresses

The class-only import does not register the element. After registration, Add Another creates a labeled field and Remove names the group it deletes. Without JavaScript or a successful CDN load, the authored email field remains usable; dynamic controls require enhancement.

<form>
  <form-repeatable>
    <div>
      <label for="email-1">Email 1</label>
      <input id="email-1" type="email" name="emails[]" />
    </div>
  </form-repeatable>
</form>

<script type="module">
  import { FormRepeatableElement } from 'https://esm.sh/@aarongustafson/form-repeatable@1.2.3/form-repeatable.js?bundle&target=es2022';

  if (!customElements.get('form-repeatable')) {
    customElements.define('form-repeatable', FormRepeatableElement);
  }
</script>