Form Enhancements
Small JS-driven enhancers that bolt onto existing inputs: input masking, password strength, character counter, and clear button.
Input mask — phone
Use data-lp-mask to specify a pattern. # = digit, A = letter, * = any character.
Input mask — credit card
Input mask — date
Password strength
Wrap a password input in data-lp-component="password-strength" — a 4-segment bar and label appear automatically.
Character counter
Set maxlength on the input and add data-lp-component="char-counter" on the wrapper. The counter turns amber at 80% and red at the limit.
Clear button
Shows a small × button inside the input that clears the value when clicked.
Reference
| Enhancer | Data attribute | Options |
|---|---|---|
| Input mask | data-lp-component="input-mask" + data-lp-mask="pattern" | mask, placeholder |
| Password strength | data-lp-component="password-strength" | — |
| Char counter | data-lp-component="char-counter" | max, warnAt (default 0.8) |
| Input clear | data-lp-component="input-clear" | — |