Web component / unpkg

<form-repeatable>

Import the guarded definition helper. See the README for the full API.

Up to three email addresses

Importing define.js automatically attempts registration; calling its helper again is safe. The max attribute limits the groups, and authored Add/Remove labels name the actions. Without JavaScript or a successful CDN load, the original labeled field remains.

<form>
  <form-repeatable
    max="3"
    add-label="Add email"
    remove-label="Remove email">
    <div>
      <label for="email-1">Email 1</label>
      <input id="email-1" type="email" name="emails[]" />
    </div>
  </form-repeatable>
</form>

<script type="module">
  import { defineFormRepeatable } from 'https://unpkg.com/@aarongustafson/form-repeatable@latest/define.js?module';

  defineFormRepeatable();
</script>