Web component / unpkg

<form-validation-list>

Password requirements with default check/cross icons. See the README for the full API.

Load the guarded registration helper

Importing define.js registers the default element when supported. Calling the exported helper again is safe. Both icon states inherit the rule’s text color. These patterns illustrate requirement matching, not a comprehensive password check or a measure of strength.

import { defineFormValidationList } from
  'https://unpkg.com/@aarongustafson/form-validation-list@latest/define.js?module';

defineFormValidationList();

<label for="password">Password</label>
<input type="password" id="password" name="password">
<form-validation-list for="password">
  <ul>
    <li data-pattern=".{8,}">At least 8 characters</li>
    <li data-pattern="[A-Z]+">One uppercase letter</li>
    <li data-pattern="[\d]+">One number</li>
  </ul>
</form-validation-list>
  • At least 8 characters
  • One uppercase letter
  • One number

If the module cannot load, the field and requirements remain visible, but the extra rules are not enforced. Always validate submitted values on the server.